diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json index 8ea981ec8a1a..c69176b9d560 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "commit": "f4e87fa447b1c30f792a0d0e474dddb7b5e92ede", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@6.1.11", + "@autorest/modelerfour@4.24.3" ], - "commit": "4cec1770664631fced06a1d83d79ebc3d2ca74db", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/recoveryservicessiterecovery/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/recoveryservicessiterecovery/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.1.11 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/recoveryservicessiterecovery/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/__init__.py index 8e4538226839..18aeca5b48fe 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/__init__.py @@ -10,10 +10,15 @@ from ._version import VERSION __version__ = VERSION -__all__ = ['SiteRecoveryManagementClient'] try: - from ._patch import patch_sdk # type: ignore - patch_sdk() + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import except ImportError: - pass + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["SiteRecoveryManagementClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py index 0b7120693ba3..c42c6ff0bd7e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py @@ -6,46 +6,50 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class SiteRecoveryManagementClientConfiguration(Configuration): +class SiteRecoveryManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for SiteRecoveryManagementClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str - :param resource_group_name: The name of the resource group where the recovery services vault is present. + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. :type resource_group_name: str - :param resource_name: The name of the recovery services vault. + :param resource_name: The name of the recovery services vault. Required. :type resource_name: str + :keyword api_version: Api Version. Default value is "2022-09-10". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + super(SiteRecoveryManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop("api_version", "2022-09-10") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -54,30 +58,30 @@ def __init__( raise ValueError("Parameter 'resource_group_name' must not be None.") if resource_name is None: raise ValueError("Parameter 'resource_name' must not be None.") - super(SiteRecoveryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id self.resource_group_name = resource_group_name self.resource_name = resource_name - self.api_version = "2021-06-01" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicessiterecovery/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicessiterecovery/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> 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) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + 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) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_metadata.json b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_metadata.json deleted file mode 100644 index 45ba43c83df4..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_metadata.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "chosen_version": "2021-06-01", - "total_api_version_list": ["2021-06-01"], - "client": { - "name": "SiteRecoveryManagementClient", - "filename": "_site_recovery_management_client", - "description": "SiteRecoveryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SiteRecoveryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SiteRecoveryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The subscription Id.", - "docstring_type": "str", - "required": true - }, - "resource_group_name": { - "signature": "resource_group_name, # type: str", - "description": "The name of the resource group where the recovery services vault is present.", - "docstring_type": "str", - "required": true - }, - "resource_name": { - "signature": "resource_name, # type: str", - "description": "The name of the recovery services vault.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The subscription Id.", - "docstring_type": "str", - "required": true - }, - "resource_group_name": { - "signature": "resource_group_name: str,", - "description": "The name of the resource group where the recovery services vault is present.", - "docstring_type": "str", - "required": true - }, - "resource_name": { - "signature": "resource_name: str,", - "description": "The name of the recovery services vault.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id, resource_group_name, resource_name", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=None, # type: Optional[str]", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: Optional[str] = None,", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "replication_alert_settings": "ReplicationAlertSettingsOperations", - "replication_eligibility_results": "ReplicationEligibilityResultsOperations", - "replication_events": "ReplicationEventsOperations", - "replication_fabrics": "ReplicationFabricsOperations", - "replication_logical_networks": "ReplicationLogicalNetworksOperations", - "replication_networks": "ReplicationNetworksOperations", - "replication_network_mappings": "ReplicationNetworkMappingsOperations", - "replication_protection_containers": "ReplicationProtectionContainersOperations", - "replication_migration_items": "ReplicationMigrationItemsOperations", - "migration_recovery_points": "MigrationRecoveryPointsOperations", - "replication_protectable_items": "ReplicationProtectableItemsOperations", - "replication_protected_items": "ReplicationProtectedItemsOperations", - "recovery_points": "RecoveryPointsOperations", - "target_compute_sizes": "TargetComputeSizesOperations", - "replication_protection_container_mappings": "ReplicationProtectionContainerMappingsOperations", - "replication_recovery_services_providers": "ReplicationRecoveryServicesProvidersOperations", - "replication_storage_classifications": "ReplicationStorageClassificationsOperations", - "replication_storage_classification_mappings": "ReplicationStorageClassificationMappingsOperations", - "replicationv_centers": "ReplicationvCentersOperations", - "replication_jobs": "ReplicationJobsOperations", - "replication_policies": "ReplicationPoliciesOperations", - "replication_protection_intents": "ReplicationProtectionIntentsOperations", - "replication_recovery_plans": "ReplicationRecoveryPlansOperations", - "supported_operating_systems": "SupportedOperatingSystemsOperations", - "replication_vault_health": "ReplicationVaultHealthOperations", - "replication_vault_setting": "ReplicationVaultSettingOperations" - } -} \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_serialization.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_serialization.py new file mode 100644 index 000000000000..7c1dedb5133d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_serialization.py @@ -0,0 +1,1970 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote # type: ignore +import xml.etree.ElementTree as ET + +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING + +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: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str # type: ignore + unicode_str = str # type: ignore + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc # type: ignore +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes=None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) + continue + if xml_desc.get("text", False): + serialized.text = new_attr + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) + 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", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) + 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) + else: # JSON + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened + + _new_attr = new_attr + _serialized = serialized + for k in keys: + if k not in _serialized: + _serialized.update(_new_attr) + _new_attr = _new_attr[k] + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback(SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) + return result + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes=None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + 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 + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) + attr = attr + padding + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py index 92cacd11a8e4..088d7da12fd3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py @@ -6,212 +6,283 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer + +from . import models +from ._configuration import SiteRecoveryManagementClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import ( + MigrationRecoveryPointsOperations, + Operations, + RecoveryPointsOperations, + ReplicationAlertSettingsOperations, + ReplicationAppliancesOperations, + ReplicationEligibilityResultsOperations, + ReplicationEventsOperations, + ReplicationFabricsOperations, + ReplicationJobsOperations, + ReplicationLogicalNetworksOperations, + ReplicationMigrationItemsOperations, + ReplicationNetworkMappingsOperations, + ReplicationNetworksOperations, + ReplicationPoliciesOperations, + ReplicationProtectableItemsOperations, + ReplicationProtectedItemsOperations, + ReplicationProtectionContainerMappingsOperations, + ReplicationProtectionContainersOperations, + ReplicationProtectionIntentsOperations, + ReplicationRecoveryPlansOperations, + ReplicationRecoveryServicesProvidersOperations, + ReplicationStorageClassificationMappingsOperations, + ReplicationStorageClassificationsOperations, + ReplicationVaultHealthOperations, + ReplicationVaultSettingOperations, + ReplicationvCentersOperations, + SupportedOperatingSystemsOperations, + TargetComputeSizesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import SiteRecoveryManagementClientConfiguration -from .operations import Operations -from .operations import ReplicationAlertSettingsOperations -from .operations import ReplicationEligibilityResultsOperations -from .operations import ReplicationEventsOperations -from .operations import ReplicationFabricsOperations -from .operations import ReplicationLogicalNetworksOperations -from .operations import ReplicationNetworksOperations -from .operations import ReplicationNetworkMappingsOperations -from .operations import ReplicationProtectionContainersOperations -from .operations import ReplicationMigrationItemsOperations -from .operations import MigrationRecoveryPointsOperations -from .operations import ReplicationProtectableItemsOperations -from .operations import ReplicationProtectedItemsOperations -from .operations import RecoveryPointsOperations -from .operations import TargetComputeSizesOperations -from .operations import ReplicationProtectionContainerMappingsOperations -from .operations import ReplicationRecoveryServicesProvidersOperations -from .operations import ReplicationStorageClassificationsOperations -from .operations import ReplicationStorageClassificationMappingsOperations -from .operations import ReplicationvCentersOperations -from .operations import ReplicationJobsOperations -from .operations import ReplicationPoliciesOperations -from .operations import ReplicationProtectionIntentsOperations -from .operations import ReplicationRecoveryPlansOperations -from .operations import SupportedOperatingSystemsOperations -from .operations import ReplicationVaultHealthOperations -from .operations import ReplicationVaultSettingOperations -from . import models -class SiteRecoveryManagementClient(object): +class SiteRecoveryManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """SiteRecoveryManagementClient. :ivar operations: Operations operations :vartype operations: azure.mgmt.recoveryservicessiterecovery.operations.Operations :ivar replication_alert_settings: ReplicationAlertSettingsOperations operations - :vartype replication_alert_settings: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAlertSettingsOperations + :vartype replication_alert_settings: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAlertSettingsOperations + :ivar replication_appliances: ReplicationAppliancesOperations operations + :vartype replication_appliances: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAppliancesOperations :ivar replication_eligibility_results: ReplicationEligibilityResultsOperations operations - :vartype replication_eligibility_results: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationEligibilityResultsOperations + :vartype replication_eligibility_results: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationEligibilityResultsOperations :ivar replication_events: ReplicationEventsOperations operations - :vartype replication_events: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationEventsOperations + :vartype replication_events: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationEventsOperations :ivar replication_fabrics: ReplicationFabricsOperations operations - :vartype replication_fabrics: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations + :vartype replication_fabrics: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations :ivar replication_logical_networks: ReplicationLogicalNetworksOperations operations - :vartype replication_logical_networks: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationLogicalNetworksOperations + :vartype replication_logical_networks: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationLogicalNetworksOperations :ivar replication_networks: ReplicationNetworksOperations operations - :vartype replication_networks: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworksOperations + :vartype replication_networks: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworksOperations :ivar replication_network_mappings: ReplicationNetworkMappingsOperations operations - :vartype replication_network_mappings: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworkMappingsOperations + :vartype replication_network_mappings: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworkMappingsOperations :ivar replication_protection_containers: ReplicationProtectionContainersOperations operations - :vartype replication_protection_containers: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations + :vartype replication_protection_containers: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations :ivar replication_migration_items: ReplicationMigrationItemsOperations operations - :vartype replication_migration_items: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations + :vartype replication_migration_items: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations :ivar migration_recovery_points: MigrationRecoveryPointsOperations operations - :vartype migration_recovery_points: azure.mgmt.recoveryservicessiterecovery.operations.MigrationRecoveryPointsOperations + :vartype migration_recovery_points: + azure.mgmt.recoveryservicessiterecovery.operations.MigrationRecoveryPointsOperations :ivar replication_protectable_items: ReplicationProtectableItemsOperations operations - :vartype replication_protectable_items: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectableItemsOperations + :vartype replication_protectable_items: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectableItemsOperations :ivar replication_protected_items: ReplicationProtectedItemsOperations operations - :vartype replication_protected_items: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations + :vartype replication_protected_items: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations :ivar recovery_points: RecoveryPointsOperations operations - :vartype recovery_points: azure.mgmt.recoveryservicessiterecovery.operations.RecoveryPointsOperations + :vartype recovery_points: + azure.mgmt.recoveryservicessiterecovery.operations.RecoveryPointsOperations :ivar target_compute_sizes: TargetComputeSizesOperations operations - :vartype target_compute_sizes: azure.mgmt.recoveryservicessiterecovery.operations.TargetComputeSizesOperations - :ivar replication_protection_container_mappings: ReplicationProtectionContainerMappingsOperations operations - :vartype replication_protection_container_mappings: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainerMappingsOperations - :ivar replication_recovery_services_providers: ReplicationRecoveryServicesProvidersOperations operations - :vartype replication_recovery_services_providers: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryServicesProvidersOperations - :ivar replication_storage_classifications: ReplicationStorageClassificationsOperations operations - :vartype replication_storage_classifications: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationsOperations - :ivar replication_storage_classification_mappings: ReplicationStorageClassificationMappingsOperations operations - :vartype replication_storage_classification_mappings: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationMappingsOperations + :vartype target_compute_sizes: + azure.mgmt.recoveryservicessiterecovery.operations.TargetComputeSizesOperations + :ivar replication_protection_container_mappings: + ReplicationProtectionContainerMappingsOperations operations + :vartype replication_protection_container_mappings: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainerMappingsOperations + :ivar replication_recovery_services_providers: ReplicationRecoveryServicesProvidersOperations + operations + :vartype replication_recovery_services_providers: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryServicesProvidersOperations + :ivar replication_storage_classifications: ReplicationStorageClassificationsOperations + operations + :vartype replication_storage_classifications: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationsOperations + :ivar replication_storage_classification_mappings: + ReplicationStorageClassificationMappingsOperations operations + :vartype replication_storage_classification_mappings: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationMappingsOperations :ivar replicationv_centers: ReplicationvCentersOperations operations - :vartype replicationv_centers: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationvCentersOperations + :vartype replicationv_centers: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationvCentersOperations :ivar replication_jobs: ReplicationJobsOperations operations - :vartype replication_jobs: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationJobsOperations + :vartype replication_jobs: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationJobsOperations :ivar replication_policies: ReplicationPoliciesOperations operations - :vartype replication_policies: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationPoliciesOperations + :vartype replication_policies: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationPoliciesOperations :ivar replication_protection_intents: ReplicationProtectionIntentsOperations operations - :vartype replication_protection_intents: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionIntentsOperations + :vartype replication_protection_intents: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionIntentsOperations :ivar replication_recovery_plans: ReplicationRecoveryPlansOperations operations - :vartype replication_recovery_plans: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations + :vartype replication_recovery_plans: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations :ivar supported_operating_systems: SupportedOperatingSystemsOperations operations - :vartype supported_operating_systems: azure.mgmt.recoveryservicessiterecovery.operations.SupportedOperatingSystemsOperations + :vartype supported_operating_systems: + azure.mgmt.recoveryservicessiterecovery.operations.SupportedOperatingSystemsOperations :ivar replication_vault_health: ReplicationVaultHealthOperations operations - :vartype replication_vault_health: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultHealthOperations + :vartype replication_vault_health: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultHealthOperations :ivar replication_vault_setting: ReplicationVaultSettingOperations operations - :vartype replication_vault_setting: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultSettingOperations - :param credential: Credential needed for the client to connect to Azure. + :vartype replication_vault_setting: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultSettingOperations + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str - :param resource_group_name: The name of the resource group where the recovery services vault is present. + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. :type resource_group_name: str - :param resource_name: The name of the recovery services vault. + :param resource_name: The name of the recovery services vault. Required. :type resource_name: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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-10". 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. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - resource_group_name, # type: str - resource_name, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SiteRecoveryManagementClientConfiguration(credential, subscription_id, resource_group_name, resource_name, **kwargs) + credential: "TokenCredential", + subscription_id: str, + resource_group_name: str, + resource_name: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SiteRecoveryManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + **kwargs + ) 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)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.replication_alert_settings = ReplicationAlertSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) + self.replication_appliances = ReplicationAppliancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.replication_eligibility_results = ReplicationEligibilityResultsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_events = ReplicationEventsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_fabrics = ReplicationFabricsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_logical_networks = ReplicationLogicalNetworksOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_networks = ReplicationNetworksOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_network_mappings = ReplicationNetworkMappingsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protection_containers = ReplicationProtectionContainersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_migration_items = ReplicationMigrationItemsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.migration_recovery_points = MigrationRecoveryPointsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protectable_items = ReplicationProtectableItemsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protected_items = ReplicationProtectedItemsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.recovery_points = RecoveryPointsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) + self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) self.target_compute_sizes = TargetComputeSizesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protection_container_mappings = ReplicationProtectionContainerMappingsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_recovery_services_providers = ReplicationRecoveryServicesProvidersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_storage_classifications = ReplicationStorageClassificationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_storage_classification_mappings = ReplicationStorageClassificationMappingsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replicationv_centers = ReplicationvCentersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_jobs = ReplicationJobsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_policies = ReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protection_intents = ReplicationProtectionIntentsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_recovery_plans = ReplicationRecoveryPlansOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.supported_operating_systems = SupportedOperatingSystemsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_vault_health = ReplicationVaultHealthOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_vault_setting = ReplicationVaultSettingOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_vendor.py new file mode 100644 index 000000000000..9aad73fc743e --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/__init__.py index 273ec3e44ae1..bc4cc297e994 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/__init__.py @@ -7,4 +7,15 @@ # -------------------------------------------------------------------------- from ._site_recovery_management_client import SiteRecoveryManagementClient -__all__ = ['SiteRecoveryManagementClient'] + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["SiteRecoveryManagementClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py index 7906d61801df..616f094bae68 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,20 +19,24 @@ from azure.core.credentials_async import AsyncTokenCredential -class SiteRecoveryManagementClientConfiguration(Configuration): +class SiteRecoveryManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for SiteRecoveryManagementClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The subscription Id. Required. :type subscription_id: str - :param resource_group_name: The name of the resource group where the recovery services vault is present. + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. :type resource_group_name: str - :param resource_name: The name of the recovery services vault. + :param resource_name: The name of the recovery services vault. Required. :type resource_name: str + :keyword api_version: Api Version. Default value is "2022-09-10". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -43,6 +47,9 @@ def __init__( resource_name: str, **kwargs: Any ) -> None: + super(SiteRecoveryManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop("api_version", "2022-09-10") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -51,29 +58,27 @@ def __init__( raise ValueError("Parameter 'resource_group_name' must not be None.") if resource_name is None: raise ValueError("Parameter 'resource_name' must not be None.") - super(SiteRecoveryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id self.resource_group_name = resource_group_name self.resource_name = resource_name - self.api_version = "2021-06-01" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicessiterecovery/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicessiterecovery/{}".format(VERSION)) self._configure(**kwargs) - 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) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + 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) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py index fde008e5a625..25ac5b4b0f2b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py @@ -6,114 +6,157 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer + +from .. import models +from .._serialization import Deserializer, Serializer +from ._configuration import SiteRecoveryManagementClientConfiguration +from .operations import ( + MigrationRecoveryPointsOperations, + Operations, + RecoveryPointsOperations, + ReplicationAlertSettingsOperations, + ReplicationAppliancesOperations, + ReplicationEligibilityResultsOperations, + ReplicationEventsOperations, + ReplicationFabricsOperations, + ReplicationJobsOperations, + ReplicationLogicalNetworksOperations, + ReplicationMigrationItemsOperations, + ReplicationNetworkMappingsOperations, + ReplicationNetworksOperations, + ReplicationPoliciesOperations, + ReplicationProtectableItemsOperations, + ReplicationProtectedItemsOperations, + ReplicationProtectionContainerMappingsOperations, + ReplicationProtectionContainersOperations, + ReplicationProtectionIntentsOperations, + ReplicationRecoveryPlansOperations, + ReplicationRecoveryServicesProvidersOperations, + ReplicationStorageClassificationMappingsOperations, + ReplicationStorageClassificationsOperations, + ReplicationVaultHealthOperations, + ReplicationVaultSettingOperations, + ReplicationvCentersOperations, + SupportedOperatingSystemsOperations, + TargetComputeSizesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SiteRecoveryManagementClientConfiguration -from .operations import Operations -from .operations import ReplicationAlertSettingsOperations -from .operations import ReplicationEligibilityResultsOperations -from .operations import ReplicationEventsOperations -from .operations import ReplicationFabricsOperations -from .operations import ReplicationLogicalNetworksOperations -from .operations import ReplicationNetworksOperations -from .operations import ReplicationNetworkMappingsOperations -from .operations import ReplicationProtectionContainersOperations -from .operations import ReplicationMigrationItemsOperations -from .operations import MigrationRecoveryPointsOperations -from .operations import ReplicationProtectableItemsOperations -from .operations import ReplicationProtectedItemsOperations -from .operations import RecoveryPointsOperations -from .operations import TargetComputeSizesOperations -from .operations import ReplicationProtectionContainerMappingsOperations -from .operations import ReplicationRecoveryServicesProvidersOperations -from .operations import ReplicationStorageClassificationsOperations -from .operations import ReplicationStorageClassificationMappingsOperations -from .operations import ReplicationvCentersOperations -from .operations import ReplicationJobsOperations -from .operations import ReplicationPoliciesOperations -from .operations import ReplicationProtectionIntentsOperations -from .operations import ReplicationRecoveryPlansOperations -from .operations import SupportedOperatingSystemsOperations -from .operations import ReplicationVaultHealthOperations -from .operations import ReplicationVaultSettingOperations -from .. import models - -class SiteRecoveryManagementClient(object): +class SiteRecoveryManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """SiteRecoveryManagementClient. :ivar operations: Operations operations :vartype operations: azure.mgmt.recoveryservicessiterecovery.aio.operations.Operations :ivar replication_alert_settings: ReplicationAlertSettingsOperations operations - :vartype replication_alert_settings: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAlertSettingsOperations + :vartype replication_alert_settings: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAlertSettingsOperations + :ivar replication_appliances: ReplicationAppliancesOperations operations + :vartype replication_appliances: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAppliancesOperations :ivar replication_eligibility_results: ReplicationEligibilityResultsOperations operations - :vartype replication_eligibility_results: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationEligibilityResultsOperations + :vartype replication_eligibility_results: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationEligibilityResultsOperations :ivar replication_events: ReplicationEventsOperations operations - :vartype replication_events: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationEventsOperations + :vartype replication_events: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationEventsOperations :ivar replication_fabrics: ReplicationFabricsOperations operations - :vartype replication_fabrics: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations + :vartype replication_fabrics: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations :ivar replication_logical_networks: ReplicationLogicalNetworksOperations operations - :vartype replication_logical_networks: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationLogicalNetworksOperations + :vartype replication_logical_networks: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationLogicalNetworksOperations :ivar replication_networks: ReplicationNetworksOperations operations - :vartype replication_networks: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworksOperations + :vartype replication_networks: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworksOperations :ivar replication_network_mappings: ReplicationNetworkMappingsOperations operations - :vartype replication_network_mappings: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworkMappingsOperations + :vartype replication_network_mappings: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworkMappingsOperations :ivar replication_protection_containers: ReplicationProtectionContainersOperations operations - :vartype replication_protection_containers: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations + :vartype replication_protection_containers: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations :ivar replication_migration_items: ReplicationMigrationItemsOperations operations - :vartype replication_migration_items: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations + :vartype replication_migration_items: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations :ivar migration_recovery_points: MigrationRecoveryPointsOperations operations - :vartype migration_recovery_points: azure.mgmt.recoveryservicessiterecovery.aio.operations.MigrationRecoveryPointsOperations + :vartype migration_recovery_points: + azure.mgmt.recoveryservicessiterecovery.aio.operations.MigrationRecoveryPointsOperations :ivar replication_protectable_items: ReplicationProtectableItemsOperations operations - :vartype replication_protectable_items: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectableItemsOperations + :vartype replication_protectable_items: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectableItemsOperations :ivar replication_protected_items: ReplicationProtectedItemsOperations operations - :vartype replication_protected_items: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations + :vartype replication_protected_items: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations :ivar recovery_points: RecoveryPointsOperations operations - :vartype recovery_points: azure.mgmt.recoveryservicessiterecovery.aio.operations.RecoveryPointsOperations + :vartype recovery_points: + azure.mgmt.recoveryservicessiterecovery.aio.operations.RecoveryPointsOperations :ivar target_compute_sizes: TargetComputeSizesOperations operations - :vartype target_compute_sizes: azure.mgmt.recoveryservicessiterecovery.aio.operations.TargetComputeSizesOperations - :ivar replication_protection_container_mappings: ReplicationProtectionContainerMappingsOperations operations - :vartype replication_protection_container_mappings: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainerMappingsOperations - :ivar replication_recovery_services_providers: ReplicationRecoveryServicesProvidersOperations operations - :vartype replication_recovery_services_providers: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryServicesProvidersOperations - :ivar replication_storage_classifications: ReplicationStorageClassificationsOperations operations - :vartype replication_storage_classifications: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationsOperations - :ivar replication_storage_classification_mappings: ReplicationStorageClassificationMappingsOperations operations - :vartype replication_storage_classification_mappings: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationMappingsOperations + :vartype target_compute_sizes: + azure.mgmt.recoveryservicessiterecovery.aio.operations.TargetComputeSizesOperations + :ivar replication_protection_container_mappings: + ReplicationProtectionContainerMappingsOperations operations + :vartype replication_protection_container_mappings: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainerMappingsOperations + :ivar replication_recovery_services_providers: ReplicationRecoveryServicesProvidersOperations + operations + :vartype replication_recovery_services_providers: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryServicesProvidersOperations + :ivar replication_storage_classifications: ReplicationStorageClassificationsOperations + operations + :vartype replication_storage_classifications: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationsOperations + :ivar replication_storage_classification_mappings: + ReplicationStorageClassificationMappingsOperations operations + :vartype replication_storage_classification_mappings: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationMappingsOperations :ivar replicationv_centers: ReplicationvCentersOperations operations - :vartype replicationv_centers: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationvCentersOperations + :vartype replicationv_centers: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationvCentersOperations :ivar replication_jobs: ReplicationJobsOperations operations - :vartype replication_jobs: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationJobsOperations + :vartype replication_jobs: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationJobsOperations :ivar replication_policies: ReplicationPoliciesOperations operations - :vartype replication_policies: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationPoliciesOperations + :vartype replication_policies: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationPoliciesOperations :ivar replication_protection_intents: ReplicationProtectionIntentsOperations operations - :vartype replication_protection_intents: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionIntentsOperations + :vartype replication_protection_intents: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionIntentsOperations :ivar replication_recovery_plans: ReplicationRecoveryPlansOperations operations - :vartype replication_recovery_plans: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations + :vartype replication_recovery_plans: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations :ivar supported_operating_systems: SupportedOperatingSystemsOperations operations - :vartype supported_operating_systems: azure.mgmt.recoveryservicessiterecovery.aio.operations.SupportedOperatingSystemsOperations + :vartype supported_operating_systems: + azure.mgmt.recoveryservicessiterecovery.aio.operations.SupportedOperatingSystemsOperations :ivar replication_vault_health: ReplicationVaultHealthOperations operations - :vartype replication_vault_health: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultHealthOperations + :vartype replication_vault_health: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultHealthOperations :ivar replication_vault_setting: ReplicationVaultSettingOperations operations - :vartype replication_vault_setting: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultSettingOperations - :param credential: Credential needed for the client to connect to Azure. + :vartype replication_vault_setting: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultSettingOperations + :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. + :param subscription_id: The subscription Id. Required. :type subscription_id: str - :param resource_group_name: The name of the resource group where the recovery services vault is present. + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. :type resource_group_name: str - :param resource_name: The name of the recovery services vault. + :param resource_name: The name of the recovery services vault. Required. :type resource_name: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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-10". 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. """ def __init__( @@ -122,92 +165,124 @@ def __init__( subscription_id: str, resource_group_name: str, resource_name: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SiteRecoveryManagementClientConfiguration(credential, subscription_id, resource_group_name, resource_name, **kwargs) + self._config = SiteRecoveryManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + **kwargs + ) 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)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.replication_alert_settings = ReplicationAlertSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) + self.replication_appliances = ReplicationAppliancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.replication_eligibility_results = ReplicationEligibilityResultsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_events = ReplicationEventsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_fabrics = ReplicationFabricsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_logical_networks = ReplicationLogicalNetworksOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_networks = ReplicationNetworksOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_network_mappings = ReplicationNetworkMappingsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protection_containers = ReplicationProtectionContainersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_migration_items = ReplicationMigrationItemsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.migration_recovery_points = MigrationRecoveryPointsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protectable_items = ReplicationProtectableItemsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protected_items = ReplicationProtectedItemsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.recovery_points = RecoveryPointsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) + self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) self.target_compute_sizes = TargetComputeSizesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protection_container_mappings = ReplicationProtectionContainerMappingsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_recovery_services_providers = ReplicationRecoveryServicesProvidersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_storage_classifications = ReplicationStorageClassificationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_storage_classification_mappings = ReplicationStorageClassificationMappingsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replicationv_centers = ReplicationvCentersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_jobs = ReplicationJobsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_policies = ReplicationPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_protection_intents = ReplicationProtectionIntentsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_recovery_plans = ReplicationRecoveryPlansOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.supported_operating_systems = SupportedOperatingSystemsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_vault_health = ReplicationVaultHealthOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.replication_vault_setting = ReplicationVaultSettingOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/__init__.py index baa6aa965187..8355227afed4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/__init__.py @@ -8,6 +8,7 @@ from ._operations import Operations from ._replication_alert_settings_operations import ReplicationAlertSettingsOperations +from ._replication_appliances_operations import ReplicationAppliancesOperations from ._replication_eligibility_results_operations import ReplicationEligibilityResultsOperations from ._replication_events_operations import ReplicationEventsOperations from ._replication_fabrics_operations import ReplicationFabricsOperations @@ -34,32 +35,39 @@ from ._replication_vault_health_operations import ReplicationVaultHealthOperations from ._replication_vault_setting_operations import ReplicationVaultSettingOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ReplicationAlertSettingsOperations', - 'ReplicationEligibilityResultsOperations', - 'ReplicationEventsOperations', - 'ReplicationFabricsOperations', - 'ReplicationLogicalNetworksOperations', - 'ReplicationNetworksOperations', - 'ReplicationNetworkMappingsOperations', - 'ReplicationProtectionContainersOperations', - 'ReplicationMigrationItemsOperations', - 'MigrationRecoveryPointsOperations', - 'ReplicationProtectableItemsOperations', - 'ReplicationProtectedItemsOperations', - 'RecoveryPointsOperations', - 'TargetComputeSizesOperations', - 'ReplicationProtectionContainerMappingsOperations', - 'ReplicationRecoveryServicesProvidersOperations', - 'ReplicationStorageClassificationsOperations', - 'ReplicationStorageClassificationMappingsOperations', - 'ReplicationvCentersOperations', - 'ReplicationJobsOperations', - 'ReplicationPoliciesOperations', - 'ReplicationProtectionIntentsOperations', - 'ReplicationRecoveryPlansOperations', - 'SupportedOperatingSystemsOperations', - 'ReplicationVaultHealthOperations', - 'ReplicationVaultSettingOperations', + "Operations", + "ReplicationAlertSettingsOperations", + "ReplicationAppliancesOperations", + "ReplicationEligibilityResultsOperations", + "ReplicationEventsOperations", + "ReplicationFabricsOperations", + "ReplicationLogicalNetworksOperations", + "ReplicationNetworksOperations", + "ReplicationNetworkMappingsOperations", + "ReplicationProtectionContainersOperations", + "ReplicationMigrationItemsOperations", + "MigrationRecoveryPointsOperations", + "ReplicationProtectableItemsOperations", + "ReplicationProtectedItemsOperations", + "RecoveryPointsOperations", + "TargetComputeSizesOperations", + "ReplicationProtectionContainerMappingsOperations", + "ReplicationRecoveryServicesProvidersOperations", + "ReplicationStorageClassificationsOperations", + "ReplicationStorageClassificationMappingsOperations", + "ReplicationvCentersOperations", + "ReplicationJobsOperations", + "ReplicationPoliciesOperations", + "ReplicationProtectionIntentsOperations", + "ReplicationRecoveryPlansOperations", + "SupportedOperatingSystemsOperations", + "ReplicationVaultHealthOperations", + "ReplicationVaultSettingOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_migration_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_migration_recovery_points_operations.py index 0036b8030ede..cf8ad7a4af31 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_migration_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_migration_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,102 +6,129 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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._migration_recovery_points_operations import ( + build_get_request, + build_list_by_replication_migration_items_request, +) -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class MigrationRecoveryPointsOperations: - """MigrationRecoveryPointsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MigrationRecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`migration_recovery_points` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_migration_items( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.MigrationRecoveryPointCollection"]: + self, fabric_name: str, protection_container_name: str, migration_item_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MigrationRecoveryPoint"]: """Gets the recovery points for a migration item. Gets the recovery points for a migration item. - :param fabric_name: Fabric unique name. + :param fabric_name: Fabric unique name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationRecoveryPointCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either MigrationRecoveryPoint or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationRecoveryPointCollection"] + _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.MigrationRecoveryPointCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_migration_items.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_migration_items_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_migration_items.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MigrationRecoveryPointCollection', pipeline_response) + deserialized = self._deserialize("MigrationRecoveryPointCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,7 +137,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -118,11 +148,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_migration_items.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_migration_items.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints"} # type: ignore + @distributed_trace_async async def get( self, fabric_name: str, @@ -130,65 +160,69 @@ async def get( migration_item_name: str, migration_recovery_point_name: str, **kwargs: Any - ) -> "_models.MigrationRecoveryPoint": + ) -> _models.MigrationRecoveryPoint: """Gets a recovery point for a migration item. Gets a recovery point for a migration item. - :param fabric_name: Fabric unique name. + :param fabric_name: Fabric unique name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param migration_recovery_point_name: The migration recovery point name. + :param migration_recovery_point_name: The migration recovery point name. Required. :type migration_recovery_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationRecoveryPoint, or the result of cls(response) + :return: MigrationRecoveryPoint or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationRecoveryPoint"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - 'migrationRecoveryPointName': self._serialize.url("migration_recovery_point_name", migration_recovery_point_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.MigrationRecoveryPoint] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + migration_recovery_point_name=migration_recovery_point_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('MigrationRecoveryPoint', pipeline_response) + deserialized = self._deserialize("MigrationRecoveryPoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_operations.py index 04b8090d6dfe..d4844f9543bb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,89 +6,112 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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._operations import build_list_request -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class Operations: - """Operations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.OperationsDiscoveryCollection"]: + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationsDiscovery"]: """Returns the list of available operations. Operation to return the list of available operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationsDiscoveryCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscoveryCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either OperationsDiscovery or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsDiscoveryCollection"] + _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.OperationsDiscoveryCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsDiscoveryCollection', pipeline_response) + deserialized = self._deserialize("OperationsDiscoveryCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -96,7 +120,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -105,7 +131,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_recovery_points_operations.py index 1a27a91dd1a9..1ab38dff3d9e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,102 +6,128 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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._recovery_points_operations import ( + build_get_request, + build_list_by_replication_protected_items_request, +) -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RecoveryPointsOperations: - """RecoveryPointsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`recovery_points` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protected_items( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.RecoveryPointCollection"]: + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> AsyncIterable["_models.RecoveryPoint"]: """Gets the list of recovery points for a replication protected item. Lists the available recovery points for a replication protected item. - :param fabric_name: The fabric name. + :param fabric_name: The fabric name. Required. :type fabric_name: str - :param protection_container_name: The protection container name. + :param protection_container_name: The protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: The replication protected item name. + :param replicated_protected_item_name: The replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RecoveryPoint or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointCollection"] + _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.RecoveryPointCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protected_items.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protected_items_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_protected_items.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RecoveryPointCollection', pipeline_response) + deserialized = self._deserialize("RecoveryPointCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,7 +136,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -118,11 +147,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_protected_items.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_protected_items.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints"} # type: ignore + @distributed_trace_async async def get( self, fabric_name: str, @@ -130,65 +159,69 @@ async def get( replicated_protected_item_name: str, recovery_point_name: str, **kwargs: Any - ) -> "_models.RecoveryPoint": + ) -> _models.RecoveryPoint: """Gets a recovery point. Get the details of specified recovery point. - :param fabric_name: The fabric name. + :param fabric_name: The fabric name. Required. :type fabric_name: str - :param protection_container_name: The protection container name. + :param protection_container_name: The protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: The replication protected item name. + :param replicated_protected_item_name: The replication protected item name. Required. :type replicated_protected_item_name: str - :param recovery_point_name: The recovery point name. + :param recovery_point_name: The recovery point name. Required. :type recovery_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryPoint, or the result of cls(response) + :return: RecoveryPoint or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPoint"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - 'recoveryPointName': self._serialize.url("recovery_point_name", recovery_point_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.RecoveryPoint] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + recovery_point_name=recovery_point_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('RecoveryPoint', pipeline_response) + deserialized = self._deserialize("RecoveryPoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_alert_settings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_alert_settings_operations.py index 943e0351e9ac..db67780aba67 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_alert_settings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_alert_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,90 +6,118 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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 - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_alert_settings_operations import ( + build_create_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationAlertSettingsOperations: - """ReplicationAlertSettingsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationAlertSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_alert_settings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.AlertCollection"]: + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: """Gets the list of configured email notification(alert) configurations. Gets the list of email notification(alert) configurations for the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AlertCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.AlertCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Alert or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Alert] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertCollection"] + _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.AlertCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertCollection', pipeline_response) + deserialized = self._deserialize("AlertCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,7 +126,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -106,131 +137,191 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - alert_setting_name: str, - **kwargs: Any - ) -> "_models.Alert": + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings"} # type: ignore + + @distributed_trace_async + async def get(self, alert_setting_name: str, **kwargs: Any) -> _models.Alert: """Gets an email notification(alert) configuration. Gets the details of the specified email notification(alert) configuration. - :param alert_setting_name: The name of the email notification configuration. + :param alert_setting_name: The name of the email notification configuration. Required. :type alert_setting_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert, or the result of cls(response) + :return: Alert or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Alert"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'alertSettingName': self._serialize.url("alert_setting_name", alert_setting_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Alert] + + request = build_get_request( + alert_setting_name=alert_setting_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('Alert', pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}'} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}"} # type: ignore + + @overload async def create( self, alert_setting_name: str, - request: "_models.ConfigureAlertRequest", + request: _models.ConfigureAlertRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.Alert": + ) -> _models.Alert: """Configures email notifications for this vault. Create or update an email notification(alert) configuration. - :param alert_setting_name: The name of the email notification(alert) configuration. + :param alert_setting_name: The name of the email notification(alert) configuration. Required. :type alert_setting_name: str - :param request: The input to configure the email notification(alert). + :param request: The input to configure the email notification(alert). Required. :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest + :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: Alert, or the result of cls(response) + :return: Alert or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, alert_setting_name: str, request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param alert_setting_name: The name of the email notification(alert) configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Required. + :type request: 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: Alert or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, alert_setting_name: str, request: Union[_models.ConfigureAlertRequest, IO], **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param alert_setting_name: The name of the email notification(alert) configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Is either a model type or + a IO type. Required. + :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest 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: Alert or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Alert"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'alertSettingName': self._serialize.url("alert_setting_name", alert_setting_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(request, 'ConfigureAlertRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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.Alert] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request, (IO, bytes)): + _content = request + else: + _json = self._serialize.body(request, "ConfigureAlertRequest") + + request = build_create_request( + alert_setting_name=alert_setting_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.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('Alert', pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}'} # type: ignore + + create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_appliances_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_appliances_operations.py new file mode 100644 index 000000000000..c87c138a5b4e --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_appliances_operations.py @@ -0,0 +1,141 @@ +# 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 +import urllib.parse + +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._replication_appliances_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ReplicationAppliancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_appliances` 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, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ReplicationAppliance"]: + """Gets the list of appliances. + + Gets the list of Azure Site Recovery appliances for the vault. + + :param filter: OData filter options. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ReplicationAppliance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] + :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.ApplianceCollection] + + 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_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _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", 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.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplianceCollection", 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.RecoveryServices/vaults/{resourceName}/replicationAppliances"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_eligibility_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_eligibility_results_operations.py index caff37fad293..7474e75891b1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_eligibility_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_eligibility_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,151 +6,162 @@ # 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, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Optional, TypeVar + +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +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._replication_eligibility_results_operations import build_get_request, build_list_request -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationEligibilityResultsOperations: - """ReplicationEligibilityResultsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationEligibilityResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_eligibility_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def list( - self, - virtual_machine_name: str, - **kwargs: Any - ) -> "_models.ReplicationEligibilityResultsCollection": + 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_async + async def list(self, virtual_machine_name: str, **kwargs: Any) -> _models.ReplicationEligibilityResultsCollection: """Gets the validation errors in case the VM is unsuitable for protection. Validates whether a given VM can be protected or not in which case returns list of errors. - :param virtual_machine_name: Virtual Machine name. + :param virtual_machine_name: Virtual Machine name. Required. :type virtual_machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationEligibilityResultsCollection, or the result of cls(response) + :return: ReplicationEligibilityResultsCollection or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsCollection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationEligibilityResultsCollection"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ReplicationEligibilityResultsCollection] + + request = build_list_request( + virtual_machine_name=virtual_machine_name, + resource_group_name=self._config.resource_group_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 + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('ReplicationEligibilityResultsCollection', pipeline_response) + deserialized = self._deserialize("ReplicationEligibilityResultsCollection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults'} # type: ignore - async def get( - self, - virtual_machine_name: str, - **kwargs: Any - ) -> "_models.ReplicationEligibilityResults": + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults"} # type: ignore + + @distributed_trace_async + async def get(self, virtual_machine_name: str, **kwargs: Any) -> _models.ReplicationEligibilityResults: """Gets the validation errors in case the VM is unsuitable for protection. Validates whether a given VM can be protected or not in which case returns list of errors. - :param virtual_machine_name: Virtual Machine name. + :param virtual_machine_name: Virtual Machine name. Required. :type virtual_machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationEligibilityResults, or the result of cls(response) + :return: ReplicationEligibilityResults or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationEligibilityResults"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + 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.ReplicationEligibilityResults] + + request = build_get_request( + virtual_machine_name=virtual_machine_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('ReplicationEligibilityResults', pipeline_response) + deserialized = self._deserialize("ReplicationEligibilityResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_events_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_events_operations.py index c3aa4afcc3a5..9473f8b02b7b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_events_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_events_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,95 +6,117 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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._replication_events_operations import build_get_request, build_list_request -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationEventsOperations: - """ReplicationEventsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationEventsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_events` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.EventCollection"]: + 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, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Event"]: """Gets the list of Azure Site Recovery events. Gets the list of Azure Site Recovery events for the vault. - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.EventCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Event or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Event] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EventCollection"] + _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.EventCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventCollection', pipeline_response) + deserialized = self._deserialize("EventCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,7 +125,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -111,65 +136,65 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - event_name: str, - **kwargs: Any - ) -> "_models.Event": + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents"} # type: ignore + + @distributed_trace_async + async def get(self, event_name: str, **kwargs: Any) -> _models.Event: """Get the details of an Azure Site recovery event. The operation to get the details of an Azure Site recovery event. - :param event_name: The name of the Azure Site Recovery event. + :param event_name: The name of the Azure Site Recovery event. Required. :type event_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event, or the result of cls(response) + :return: Event or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Event - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Event"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'eventName': self._serialize.url("event_name", event_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Event] + + request = build_get_request( + event_name=event_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('Event', pipeline_response) + deserialized = self._deserialize("Event", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py index 09373f6446c9..0a29ac21799c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,92 +6,126 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_fabrics_operations import ( + build_check_consistency_request, + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_migrate_to_aad_request, + build_purge_request, + build_reassociate_gateway_request, + build_renew_certificate_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationFabricsOperations: - """ReplicationFabricsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationFabricsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_fabrics` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.FabricCollection"]: + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Fabric"]: """Gets the list of ASR fabrics. Gets a list of the Azure Site Recovery fabrics in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FabricCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.FabricCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Fabric or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FabricCollection"] + _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.FabricCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FabricCollection', pipeline_response) + deserialized = self._deserialize("FabricCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,7 +134,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -108,113 +145,118 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - fabric_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> "_models.Fabric": + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics"} # type: ignore + + @distributed_trace_async + async def get(self, fabric_name: str, filter: Optional[str] = None, **kwargs: Any) -> _models.Fabric: """Gets the details of an ASR fabric. Gets the details of an Azure Site Recovery fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Fabric, or the result of cls(response) + :return: Fabric or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Fabric - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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.Fabric] + + request = build_get_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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 - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore async def _create_initial( - self, - fabric_name: str, - input: "_models.FabricCreationInput", - **kwargs: Any - ) -> Optional["_models.Fabric"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Fabric"]] + self, fabric_name: str, input: Union[_models.FabricCreationInput, IO], **kwargs: Any + ) -> Optional[_models.Fabric]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'FabricCreationInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Fabric]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "FabricCreationInput") + + request = build_create_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -223,115 +265,188 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore + + @overload async def begin_create( self, fabric_name: str, - input: "_models.FabricCreationInput", + input: _models.FabricCreationInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.Fabric"]: + ) -> AsyncLROPoller[_models.Fabric]: """Creates an Azure Site Recovery fabric. The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). - :param fabric_name: Name of the ASR fabric. + :param fabric_name: Name of the ASR fabric. Required. :type fabric_name: str - :param input: Fabric creation input. + :param input: Fabric creation input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Fabric or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, fabric_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param fabric_name: Name of the ASR fabric. Required. + :type fabric_name: str + :param input: Fabric creation input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, fabric_name: str, input: Union[_models.FabricCreationInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param fabric_name: Name of the ASR fabric. Required. + :type fabric_name: str + :param input: Fabric creation input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Fabric] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore fabric_name=fabric_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fabric', pipeline_response) - + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _purge_initial( - self, - fabric_name: str, - **kwargs: Any + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore + + async def _purge_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_purge_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -341,104 +456,100 @@ async def _purge_initial( if cls: return cls(pipeline_response, None, {}) - _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore - async def begin_purge( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + @distributed_trace_async + async def begin_purge(self, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Purges the site. The operation to purge(force delete) an Azure Site Recovery fabric. - :param fabric_name: ASR fabric to purge. + :param fabric_name: ASR fabric to purge. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_initial( + raw_result = await self._purge_initial( # type: ignore fabric_name=fabric_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _check_consistency_initial( - self, - fabric_name: str, - **kwargs: Any - ) -> Optional["_models.Fabric"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Fabric"]] + begin_purge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore + + async def _check_consistency_initial(self, fabric_name: str, **kwargs: Any) -> Optional[_models.Fabric]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._check_consistency_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.Fabric]] + + request = build_check_consistency_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._check_consistency_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -447,111 +558,113 @@ async def _check_consistency_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _check_consistency_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency'} # type: ignore - async def begin_check_consistency( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.Fabric"]: + _check_consistency_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency"} # type: ignore + + @distributed_trace_async + async def begin_check_consistency(self, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[_models.Fabric]: """Checks the consistency of the ASR fabric. The operation to perform a consistency check on the fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Fabric or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fabric] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._check_consistency_initial( + raw_result = await self._check_consistency_initial( # type: ignore fabric_name=fabric_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fabric', pipeline_response) - + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_check_consistency.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _migrate_to_aad_initial( - self, - fabric_name: str, - **kwargs: Any + begin_check_consistency.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency"} # type: ignore + + async def _migrate_to_aad_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._migrate_to_aad_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_migrate_to_aad_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._migrate_to_aad_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -561,110 +674,117 @@ async def _migrate_to_aad_initial( if cls: return cls(pipeline_response, None, {}) - _migrate_to_aad_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad'} # type: ignore + _migrate_to_aad_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad"} # type: ignore - async def begin_migrate_to_aad( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + @distributed_trace_async + async def begin_migrate_to_aad(self, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Migrates the site to AAD. The operation to migrate an Azure Site Recovery fabric to AAD. - :param fabric_name: ASR fabric to migrate. + :param fabric_name: ASR fabric to migrate. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._migrate_to_aad_initial( + raw_result = await self._migrate_to_aad_initial( # type: ignore fabric_name=fabric_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_to_aad.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_migrate_to_aad.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad"} # type: ignore async def _reassociate_gateway_initial( self, fabric_name: str, - failover_process_server_request: "_models.FailoverProcessServerRequest", + failover_process_server_request: Union[_models.FailoverProcessServerRequest, IO], **kwargs: Any - ) -> Optional["_models.Fabric"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Fabric"]] + ) -> Optional[_models.Fabric]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reassociate_gateway_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(failover_process_server_request, 'FailoverProcessServerRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Fabric]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(failover_process_server_request, (IO, bytes)): + _content = failover_process_server_request + else: + _json = self._serialize.body(failover_process_server_request, "FailoverProcessServerRequest") + + request = build_reassociate_gateway_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reassociate_gateway_initial.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, 202]: @@ -673,115 +793,201 @@ async def _reassociate_gateway_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _reassociate_gateway_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway'} # type: ignore + _reassociate_gateway_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway"} # type: ignore + + @overload async def begin_reassociate_gateway( self, fabric_name: str, - failover_process_server_request: "_models.FailoverProcessServerRequest", + failover_process_server_request: _models.FailoverProcessServerRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.Fabric"]: + ) -> AsyncLROPoller[_models.Fabric]: """Perform failover of the process server. The operation to move replications from a process server to another process server. - :param fabric_name: The name of the fabric containing the process server. + :param fabric_name: The name of the fabric containing the process server. Required. :type fabric_name: str :param failover_process_server_request: The input to the failover process server operation. - :type failover_process_server_request: ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest + Required. + :type failover_process_server_request: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Fabric or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_reassociate_gateway( + self, + fabric_name: str, + failover_process_server_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param fabric_name: The name of the fabric containing the process server. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. + Required. + :type failover_process_server_request: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reassociate_gateway( + self, + fabric_name: str, + failover_process_server_request: Union[_models.FailoverProcessServerRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param fabric_name: The name of the fabric containing the process server. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. Is + either a model type or a IO type. Required. + :type failover_process_server_request: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Fabric] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._reassociate_gateway_initial( + raw_result = await self._reassociate_gateway_initial( # type: ignore fabric_name=fabric_name, failover_process_server_request=failover_process_server_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fabric', pipeline_response) - + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reassociate_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( - self, - fabric_name: str, - **kwargs: Any + begin_reassociate_gateway.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -791,110 +997,114 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove"} # type: ignore - async def begin_delete( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + @distributed_trace_async + async def begin_delete(self, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes the site. The operation to delete or remove an Azure Site Recovery fabric. - :param fabric_name: ASR fabric to delete. + :param fabric_name: ASR fabric to delete. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore fabric_name=fabric_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove"} # type: ignore async def _renew_certificate_initial( - self, - fabric_name: str, - renew_certificate: "_models.RenewCertificateInput", - **kwargs: Any - ) -> Optional["_models.Fabric"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Fabric"]] + self, fabric_name: str, renew_certificate: Union[_models.RenewCertificateInput, IO], **kwargs: Any + ) -> Optional[_models.Fabric]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._renew_certificate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(renew_certificate, 'RenewCertificateInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Fabric]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(renew_certificate, (IO, bytes)): + _content = renew_certificate + else: + _json = self._serialize.body(renew_certificate, "RenewCertificateInput") + + request = build_renew_certificate_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._renew_certificate_initial.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, 202]: @@ -903,80 +1113,152 @@ async def _renew_certificate_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _renew_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate'} # type: ignore + _renew_certificate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate"} # type: ignore + + @overload async def begin_renew_certificate( self, fabric_name: str, - renew_certificate: "_models.RenewCertificateInput", + renew_certificate: _models.RenewCertificateInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.Fabric"]: + ) -> AsyncLROPoller[_models.Fabric]: """Renews certificate for the fabric. Renews the connection certificate for the ASR replication fabric. - :param fabric_name: fabric name to renew certs for. + :param fabric_name: fabric name to renew certs for. Required. :type fabric_name: str - :param renew_certificate: Renew certificate input. + :param renew_certificate: Renew certificate input. Required. :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Fabric or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_renew_certificate( + self, fabric_name: str, renew_certificate: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param fabric_name: fabric name to renew certs for. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Required. + :type renew_certificate: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_renew_certificate( + self, fabric_name: str, renew_certificate: Union[_models.RenewCertificateInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param fabric_name: fabric name to renew certs for. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Is either a model type or a IO type. + Required. + :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fabric or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Fabric] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._renew_certificate_initial( + raw_result = await self._renew_certificate_initial( # type: ignore fabric_name=fabric_name, renew_certificate=renew_certificate, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fabric', pipeline_response) - + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_renew_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_renew_certificate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_jobs_operations.py index 7911ede448ea..201feccb48c1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,97 +6,126 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_jobs_operations import ( + build_cancel_request, + build_export_request, + build_get_request, + build_list_request, + build_restart_request, + build_resume_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationJobsOperations: - """ReplicationJobsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.JobCollection"]: + @distributed_trace + def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Job"]: """Gets the list of jobs. Gets the list of Azure Site Recovery Jobs for the vault. - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.JobCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Job or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollection"] + _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.JobCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('JobCollection', pipeline_response) + deserialized = self._deserialize("JobCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,7 +134,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -113,102 +145,101 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - job_name: str, - **kwargs: Any - ) -> "_models.Job": + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs"} # type: ignore + + @distributed_trace_async + async def get(self, job_name: str, **kwargs: Any) -> _models.Job: """Gets the job details. Get the details of an Azure Site Recovery job. - :param job_name: Job identifier. + :param job_name: Job identifier. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Job, or the result of cls(response) + :return: Job or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Job - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Job] + + request = build_get_request( + job_name=job_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}'} # type: ignore - async def _cancel_initial( - self, - job_name: str, - **kwargs: Any - ) -> Optional["_models.Job"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}"} # type: ignore + + async def _cancel_initial(self, job_name: str, **kwargs: Any) -> Optional[_models.Job]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.Job]] + + request = build_cancel_request( + job_name=job_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._cancel_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -217,113 +248,109 @@ async def _cancel_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel'} # type: ignore - async def begin_cancel( - self, - job_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.Job"]: + _cancel_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel"} # type: ignore + + @distributed_trace_async + async def begin_cancel(self, job_name: str, **kwargs: Any) -> AsyncLROPoller[_models.Job]: """Cancels the specified job. The operation to cancel an Azure Site Recovery job. - :param job_name: Job identifier. + :param job_name: Job identifier. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._cancel_initial( + raw_result = await self._cancel_initial( # type: ignore job_name=job_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Job', pipeline_response) - + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _restart_initial( - self, - job_name: str, - **kwargs: Any - ) -> Optional["_models.Job"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + begin_cancel.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel"} # type: ignore + + async def _restart_initial(self, job_name: str, **kwargs: Any) -> Optional[_models.Job]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.Job]] + + request = build_restart_request( + job_name=job_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._restart_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -332,119 +359,123 @@ async def _restart_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart'} # type: ignore - async def begin_restart( - self, - job_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.Job"]: + _restart_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart"} # type: ignore + + @distributed_trace_async + async def begin_restart(self, job_name: str, **kwargs: Any) -> AsyncLROPoller[_models.Job]: """Restarts the specified job. The operation to restart an Azure Site Recovery job. - :param job_name: Job identifier. + :param job_name: Job identifier. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._restart_initial( + raw_result = await self._restart_initial( # type: ignore job_name=job_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Job', pipeline_response) - + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart"} # type: ignore async def _resume_initial( - self, - job_name: str, - resume_job_params: "_models.ResumeJobParams", - **kwargs: Any - ) -> Optional["_models.Job"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + self, job_name: str, resume_job_params: Union[_models.ResumeJobParams, IO], **kwargs: Any + ) -> Optional[_models.Job]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._resume_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resume_job_params, 'ResumeJobParams') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Job]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resume_job_params, (IO, bytes)): + _content = resume_job_params + else: + _json = self._serialize.body(resume_job_params, "ResumeJobParams") + + request = build_resume_request( + job_name=job_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resume_initial.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, 202]: @@ -453,121 +484,193 @@ async def _resume_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume'} # type: ignore + _resume_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume"} # type: ignore + + @overload async def begin_resume( self, job_name: str, - resume_job_params: "_models.ResumeJobParams", + resume_job_params: _models.ResumeJobParams, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.Job"]: + ) -> AsyncLROPoller[_models.Job]: """Resumes the specified job. The operation to resume an Azure Site Recovery job. - :param job_name: Job identifier. + :param job_name: Job identifier. Required. :type job_name: str - :param resume_job_params: Resume rob comments. + :param resume_job_params: Resume rob comments. Required. :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_resume( + self, job_name: str, resume_job_params: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Required. + :type resume_job_params: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resume( + self, job_name: str, resume_job_params: Union[_models.ResumeJobParams, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Is either a model type or a IO type. Required. + :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Job] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._resume_initial( + raw_result = await self._resume_initial( # type: ignore job_name=job_name, resume_job_params=resume_job_params, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Job', pipeline_response) - + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume"} # type: ignore async def _export_initial( - self, - job_query_parameter: "_models.JobQueryParameter", - **kwargs: Any - ) -> Optional["_models.Job"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + self, job_query_parameter: Union[_models.JobQueryParameter, IO], **kwargs: Any + ) -> Optional[_models.Job]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._export_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job_query_parameter, 'JobQueryParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Job]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_query_parameter, (IO, bytes)): + _content = job_query_parameter + else: + _json = self._serialize.body(job_query_parameter, "JobQueryParameter") + + request = build_export_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._export_initial.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, 202]: @@ -576,75 +679,133 @@ async def _export_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _export_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export'} # type: ignore + _export_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export"} # type: ignore + + @overload async def begin_export( - self, - job_query_parameter: "_models.JobQueryParameter", - **kwargs: Any - ) -> AsyncLROPoller["_models.Job"]: + self, job_query_parameter: _models.JobQueryParameter, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: """Exports the details of the Azure Site Recovery jobs of the vault. The operation to export the details of the Azure Site Recovery jobs of the vault. - :param job_query_parameter: job query filter. + :param job_query_parameter: job query filter. Required. :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_export( + self, job_query_parameter: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param job_query_parameter: job query filter. Required. + :type job_query_parameter: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_export( + self, job_query_parameter: Union[_models.JobQueryParameter, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param job_query_parameter: job query filter. Is either a model type or a IO type. Required. + :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Job] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._export_initial( + raw_result = await self._export_initial( # type: ignore job_query_parameter=job_query_parameter, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Job', pipeline_response) - + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_export.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_logical_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_logical_networks_operations.py index 4457d21fc2b2..4d9faf3376ed 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_logical_networks_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_logical_networks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,94 +6,120 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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._replication_logical_networks_operations import ( + build_get_request, + build_list_by_replication_fabrics_request, +) -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationLogicalNetworksOperations: - """ReplicationLogicalNetworksOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationLogicalNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_logical_networks` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_replication_fabrics( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.LogicalNetworkCollection"]: + 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_by_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> AsyncIterable["_models.LogicalNetwork"]: """Gets the list of logical networks under a fabric. Lists all the logical networks of the Azure Site Recovery fabric. - :param fabric_name: Server Id. + :param fabric_name: Server Id. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LogicalNetworkCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either LogicalNetwork or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LogicalNetworkCollection"] + _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.LogicalNetworkCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('LogicalNetworkCollection', pipeline_response) + deserialized = self._deserialize("LogicalNetworkCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,7 +128,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -110,69 +139,68 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks'} # type: ignore - - async def get( - self, - fabric_name: str, - logical_network_name: str, - **kwargs: Any - ) -> "_models.LogicalNetwork": + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks"} # type: ignore + + @distributed_trace_async + async def get(self, fabric_name: str, logical_network_name: str, **kwargs: Any) -> _models.LogicalNetwork: """Gets a logical network with specified server id and logical network name. Gets the details of a logical network. - :param fabric_name: Server Id. + :param fabric_name: Server Id. Required. :type fabric_name: str - :param logical_network_name: Logical network name. + :param logical_network_name: Logical network name. Required. :type logical_network_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogicalNetwork, or the result of cls(response) + :return: LogicalNetwork or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LogicalNetwork"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'logicalNetworkName': self._serialize.url("logical_network_name", logical_network_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.LogicalNetwork] + + request = build_get_request( + fabric_name=fabric_name, + logical_network_name=logical_network_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('LogicalNetwork', pipeline_response) + deserialized = self._deserialize("LogicalNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_migration_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_migration_items_operations.py index 7f27db60edd5..356402ff6b47 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_migration_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_migration_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,44 +6,69 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_migration_items_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_replication_protection_containers_request, + build_list_request, + build_migrate_request, + build_pause_replication_request, + build_resume_replication_request, + build_resync_request, + build_test_migrate_cleanup_request, + build_test_migrate_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationMigrationItemsOperations: - """ReplicationMigrationItemsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationMigrationItemsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_migration_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protection_containers( self, fabric_name: str, @@ -51,69 +77,81 @@ def list_by_replication_protection_containers( take_token: Optional[str] = None, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.MigrationItemCollection"]: + ) -> AsyncIterable["_models.MigrationItem"]: """Gets the list of migration items in the protection container. Gets the list of ASR migration items in the protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param skip_token: The pagination token. + :param skip_token: The pagination token. Default value is None. :type skip_token: str - :param take_token: The page size. + :param take_token: The page size. Default value is None. :type take_token: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationItemCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either MigrationItem or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItemCollection"] + _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.MigrationItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protection_containers.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if take_token is not None: - query_parameters['takeToken'] = self._serialize.query("take_token", take_token, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protection_containers_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + filter=filter, + api_version=api_version, + template_url=self.list_by_replication_protection_containers.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MigrationItemCollection', pipeline_response) + deserialized = self._deserialize("MigrationItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,7 +160,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -131,120 +171,130 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_protection_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + list_by_replication_protection_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems"} # type: ignore + + @distributed_trace_async async def get( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - **kwargs: Any - ) -> "_models.MigrationItem": + self, fabric_name: str, protection_container_name: str, migration_item_name: str, **kwargs: Any + ) -> _models.MigrationItem: """Gets the details of a migration item. Gets the details of a migration item. - :param fabric_name: Fabric unique name. + :param fabric_name: Fabric unique name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationItem, or the result of cls(response) + :return: MigrationItem or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.MigrationItem] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore async def _create_initial( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - input: "_models.EnableMigrationInput", + input: Union[_models.EnableMigrationInput, IO], **kwargs: Any - ) -> Optional["_models.MigrationItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'EnableMigrationInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "EnableMigrationInput") + + request = build_create_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -253,95 +303,183 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore + + @overload async def begin_create( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - input: "_models.EnableMigrationInput", + input: _models.EnableMigrationInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.MigrationItem"]: + ) -> AsyncLROPoller[_models.MigrationItem]: """Enables migration. The operation to create an ASR migration item (enable migration). - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param input: Enable migration input. + :param input: Enable migration input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.EnableMigrationInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, fabric_name: str, protection_container_name: str, @@ -349,36 +487,40 @@ async def _delete_initial( delete_option: Optional[str] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if delete_option is not None: - query_parameters['deleteOption'] = self._serialize.query("delete_option", delete_option, 'str') + 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( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + delete_option=delete_option, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -388,8 +530,9 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore + @distributed_trace_async async def begin_delete( self, fabric_name: str, @@ -402,114 +545,122 @@ async def begin_delete( The operation to delete an ASR migration item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param delete_option: The delete option. + :param delete_option: The delete option. Default value is None. :type delete_option: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, delete_option=delete_option, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore async def _update_initial( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - input: "_models.UpdateMigrationItemInput", + input: Union[_models.UpdateMigrationItemInput, IO], **kwargs: Any - ) -> Optional["_models.MigrationItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'UpdateMigrationItemInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "UpdateMigrationItemInput") + + request = build_update_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -518,137 +669,235 @@ async def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore + + @overload async def begin_update( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - input: "_models.UpdateMigrationItemInput", + input: _models.UpdateMigrationItemInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.MigrationItem"]: + ) -> AsyncLROPoller[_models.MigrationItem]: """Updates migration item. The operation to update the recovery settings of an ASR migration item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param input: Update migration item input. + :param input: Update migration item input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_update( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.UpdateMigrationItemInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore async def _migrate_initial( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - migrate_input: "_models.MigrateInput", + migrate_input: Union[_models.MigrateInput, IO], **kwargs: Any - ) -> Optional["_models.MigrationItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._migrate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(migrate_input, 'MigrateInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(migrate_input, (IO, bytes)): + _content = migrate_input + else: + _json = self._serialize.body(migrate_input, "MigrateInput") + + request = build_migrate_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._migrate_initial.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, 202]: @@ -657,276 +906,235 @@ async def _migrate_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _migrate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate'} # type: ignore + _migrate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate"} # type: ignore + + @overload async def begin_migrate( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - migrate_input: "_models.MigrateInput", + migrate_input: _models.MigrateInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.MigrationItem"]: + ) -> AsyncLROPoller[_models.MigrationItem]: """Migrate item. The operation to initiate migration of the item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param migrate_input: Migrate input. + :param migrate_input: Migrate input. Required. :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._migrate_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - migrate_input=migrate_input, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate'} # type: ignore - async def _resync_initial( + @overload + async def begin_migrate( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - input: "_models.ResyncInput", + migrate_input: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Optional["_models.MigrationItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._resync_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'ResyncInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + ) -> AsyncLROPoller[_models.MigrationItem]: + """Migrate item. - if cls: - return cls(pipeline_response, deserialized, {}) + The operation to initiate migration of the item. - return deserialized - _resync_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync'} # type: ignore + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Required. + :type migrate_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ - async def begin_resync( + @distributed_trace_async + async def begin_migrate( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - input: "_models.ResyncInput", + migrate_input: Union[_models.MigrateInput, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.MigrationItem"]: - """Resynchronizes replication. + ) -> AsyncLROPoller[_models.MigrationItem]: + """Migrate item. - The operation to resynchronize replication of an ASR migration item. + The operation to initiate migration of the item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param input: Resync input. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput + :param migrate_input: Migrate input. Is either a model type or a IO type. Required. + :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[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", 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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._resync_initial( + raw_result = await self._migrate_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, - input=input, - cls=lambda x,y,z: x, + migrate_input=migrate_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_resync.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _test_migrate_initial( + begin_migrate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate"} # type: ignore + + async def _pause_replication_initial( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - test_migrate_input: "_models.TestMigrateInput", + pause_replication_input: Union[_models.PauseReplicationInput, IO], **kwargs: Any - ) -> Optional["_models.MigrationItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_migrate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(test_migrate_input, 'TestMigrateInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pause_replication_input, (IO, bytes)): + _content = pause_replication_input + else: + _json = self._serialize.body(pause_replication_input, "PauseReplicationInput") + + request = build_pause_replication_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._pause_replication_initial.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, 202]: @@ -935,137 +1143,953 @@ async def _test_migrate_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_migrate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate'} # type: ignore - async def begin_test_migrate( + _pause_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication"} # type: ignore + + @overload + async def begin_pause_replication( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - test_migrate_input: "_models.TestMigrateInput", + pause_replication_input: _models.PauseReplicationInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.MigrationItem"]: - """Test migrate item. + ) -> AsyncLROPoller[_models.MigrationItem]: + """Pause replication. - The operation to initiate test migration of the item. + The operation to initiate pause replication of the item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param test_migrate_input: Test migrate input. - :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._test_migrate_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - test_migrate_input=test_migrate_input, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + @overload + async def begin_pause_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Pause replication. - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) + The operation to initiate pause replication of the item. - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_pause_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: Union[_models.PauseReplicationInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Pause replication. - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), + The operation to initiate pause replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Is either a model type or a IO type. + Required. + :type pause_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._pause_replication_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + pause_replication_input=pause_replication_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MigrationItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_pause_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication"} # type: ignore + + async def _resume_replication_initial( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: Union[_models.ResumeReplicationInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } + error_map.update(kwargs.pop("error_map", {}) or {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + _headers = case_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.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resume_replication_input, (IO, bytes)): + _content = resume_replication_input + else: + _json = self._serialize.body(resume_replication_input, "ResumeReplicationInput") + + request = build_resume_replication_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resume_replication_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MigrationItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _resume_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication"} # type: ignore + + @overload + async def begin_resume_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: _models.ResumeReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resume_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resume_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: Union[_models.ResumeReplicationInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Is either a model type or a IO type. + Required. + :type resume_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._resume_replication_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resume_replication_input=resume_replication_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MigrationItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication"} # type: ignore + + async def _resync_initial( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.ResyncInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate'} # type: ignore + _json = self._serialize.body(input, "ResyncInput") + + request = build_resync_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resync_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - async def _test_migrate_cleanup_initial( + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MigrationItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _resync_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync"} # type: ignore + + @overload + async def begin_resync( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.ResyncInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resync( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resync( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - test_migrate_cleanup_input: "_models.TestMigrateCleanupInput", + input: Union[_models.ResyncInput, IO], **kwargs: Any - ) -> Optional["_models.MigrationItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._resync_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + input=input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MigrationItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resync.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync"} # type: ignore + + async def _test_migrate_initial( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: Union[_models.TestMigrateInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_migrate_cleanup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(test_migrate_input, (IO, bytes)): + _content = test_migrate_input + else: + _json = self._serialize.body(test_migrate_input, "TestMigrateInput") + + request = build_test_migrate_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_migrate_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MigrationItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _test_migrate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate"} # type: ignore + + @overload + async def begin_test_migrate( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: _models.TestMigrateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Required. + :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_migrate( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Required. + :type test_migrate_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_migrate( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: Union[_models.TestMigrateInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Is either a model type or a IO type. Required. + :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._test_migrate_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + test_migrate_input=test_migrate_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MigrationItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_migrate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate"} # type: ignore + + async def _test_migrate_cleanup_initial( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(test_migrate_cleanup_input, 'TestMigrateCleanupInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(test_migrate_cleanup_input, (IO, bytes)): + _content = test_migrate_cleanup_input + else: + _json = self._serialize.body(test_migrate_cleanup_input, "TestMigrateCleanupInput") + + request = build_test_migrate_cleanup_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_migrate_cleanup_initial.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, 202]: @@ -1074,157 +2098,261 @@ async def _test_migrate_cleanup_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_migrate_cleanup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup'} # type: ignore + _test_migrate_cleanup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup"} # type: ignore + + @overload async def begin_test_migrate_cleanup( self, fabric_name: str, protection_container_name: str, migration_item_name: str, - test_migrate_cleanup_input: "_models.TestMigrateCleanupInput", + test_migrate_cleanup_input: _models.TestMigrateCleanupInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.MigrationItem"]: + ) -> AsyncLROPoller[_models.MigrationItem]: """Test migrate cleanup. The operation to initiate test migrate cleanup. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param test_migrate_cleanup_input: Test migrate cleanup input. - :type test_migrate_cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_test_migrate_cleanup( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_migrate_cleanup( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Is either a model type or a IO + type. Required. + :type test_migrate_cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._test_migrate_cleanup_initial( + raw_result = await self._test_migrate_cleanup_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, test_migrate_cleanup_input=test_migrate_cleanup_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_migrate_cleanup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_migrate_cleanup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup"} # type: ignore + @distributed_trace def list( self, skip_token: Optional[str] = None, take_token: Optional[str] = None, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.MigrationItemCollection"]: + ) -> AsyncIterable["_models.MigrationItem"]: """Gets the list of migration items in the vault. Gets the list of migration items in the vault. - :param skip_token: The pagination token. + :param skip_token: The pagination token. Default value is None. :type skip_token: str - :param take_token: The page size. + :param take_token: The page size. Default value is None. :type take_token: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationItemCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either MigrationItem or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItemCollection"] + _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.MigrationItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if take_token is not None: - query_parameters['takeToken'] = self._serialize.query("take_token", take_token, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MigrationItemCollection', pipeline_response) + deserialized = self._deserialize("MigrationItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1233,7 +2361,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1242,7 +2372,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_network_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_network_mappings_operations.py index 3bbaa3a25171..54492e22dc55 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_network_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_network_mappings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,131 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_network_mappings_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_replication_networks_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationNetworkMappingsOperations: - """ReplicationNetworkMappingsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationNetworkMappingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_network_mappings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_networks( - self, - fabric_name: str, - network_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.NetworkMappingCollection"]: + self, fabric_name: str, network_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkMapping"]: """Gets all the network mappings under a network. Lists all ASR network mappings for the specified network. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkMappingCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either NetworkMapping or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMappingCollection"] + _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.NetworkMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_networks.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_networks_request( + fabric_name=fabric_name, + network_name=network_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_networks.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkMappingCollection', pipeline_response) + deserialized = self._deserialize("NetworkMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,7 +139,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -116,120 +150,130 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_networks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_networks.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings"} # type: ignore + @distributed_trace_async async def get( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - **kwargs: Any - ) -> "_models.NetworkMapping": + self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any + ) -> _models.NetworkMapping: """Gets network mapping by name. Gets the details of an ASR network mapping. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str - :param network_mapping_name: Network mapping name. + :param network_mapping_name: Network mapping name. Required. :type network_mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkMapping, or the result of cls(response) + :return: NetworkMapping or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMapping"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.NetworkMapping] + + request = build_get_request( + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('NetworkMapping', pipeline_response) + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore async def _create_initial( self, fabric_name: str, network_name: str, network_mapping_name: str, - input: "_models.CreateNetworkMappingInput", + input: Union[_models.CreateNetworkMappingInput, IO], **kwargs: Any - ) -> Optional["_models.NetworkMapping"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NetworkMapping"]] + ) -> Optional[_models.NetworkMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CreateNetworkMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.NetworkMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "CreateNetworkMappingInput") + + request = build_create_request( + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -238,129 +282,218 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NetworkMapping', pipeline_response) + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + + @overload async def begin_create( self, fabric_name: str, network_name: str, network_mapping_name: str, - input: "_models.CreateNetworkMappingInput", + input: _models.CreateNetworkMappingInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.NetworkMapping"]: + ) -> AsyncLROPoller[_models.NetworkMapping]: """Creates network mapping. The operation to create an ASR network mapping. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str - :param network_mapping_name: Network mapping name. + :param network_mapping_name: Network mapping name. Required. :type network_mapping_name: str - :param input: Create network mapping input. + :param input: Create network mapping input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param fabric_name: Primary fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.CreateNetworkMappingInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param fabric_name: Primary fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.NetworkMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore fabric_name=fabric_name, network_name=network_name, network_mapping_name=network_mapping_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('NetworkMapping', pipeline_response) - + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - **kwargs: Any + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -370,124 +503,129 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + @distributed_trace_async async def begin_delete( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - **kwargs: Any + self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Delete network mapping. The operation to delete a network mapping. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str - :param network_mapping_name: ARM Resource Name for network mapping. + :param network_mapping_name: ARM Resource Name for network mapping. Required. :type network_mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore fabric_name=fabric_name, network_name=network_name, network_mapping_name=network_mapping_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore async def _update_initial( self, fabric_name: str, network_name: str, network_mapping_name: str, - input: "_models.UpdateNetworkMappingInput", + input: Union[_models.UpdateNetworkMappingInput, IO], **kwargs: Any - ) -> Optional["_models.NetworkMapping"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NetworkMapping"]] + ) -> Optional[_models.NetworkMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'UpdateNetworkMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.NetworkMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "UpdateNetworkMappingInput") + + request = build_update_request( + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -496,142 +634,243 @@ async def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NetworkMapping', pipeline_response) + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + + @overload async def begin_update( self, fabric_name: str, network_name: str, network_mapping_name: str, - input: "_models.UpdateNetworkMappingInput", + input: _models.UpdateNetworkMappingInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.NetworkMapping"]: + ) -> AsyncLROPoller[_models.NetworkMapping]: """Updates network mapping. The operation to update an ASR network mapping. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str - :param network_mapping_name: Network mapping name. + :param network_mapping_name: Network mapping name. Required. :type network_mapping_name: str - :param input: Update network mapping input. + :param input: Update network mapping input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_update( + self, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param fabric_name: Primary fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.UpdateNetworkMappingInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param fabric_name: Primary fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.NetworkMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore fabric_name=fabric_name, network_name=network_name, network_mapping_name=network_mapping_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('NetworkMapping', pipeline_response) - + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.NetworkMappingCollection"]: + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.NetworkMapping"]: """Gets all the network mappings under a vault. Lists all ASR network mappings in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkMappingCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either NetworkMapping or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMappingCollection"] + _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.NetworkMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkMappingCollection', pipeline_response) + deserialized = self._deserialize("NetworkMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -640,7 +879,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -649,7 +890,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_networks_operations.py index 6d52180d1ad0..d3d402a94106 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_networks_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_networks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,94 +6,121 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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 - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_networks_operations import ( + build_get_request, + build_list_by_replication_fabrics_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationNetworksOperations: - """ReplicationNetworksOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_networks` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_replication_fabrics( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.NetworkCollection"]: + 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_by_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> AsyncIterable["_models.Network"]: """Gets the list of networks under a fabric. Lists the networks available for a fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Network or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkCollection"] + _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.NetworkCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkCollection', pipeline_response) + deserialized = self._deserialize("NetworkCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,7 +129,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -110,121 +140,133 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks'} # type: ignore - - async def get( - self, - fabric_name: str, - network_name: str, - **kwargs: Any - ) -> "_models.Network": + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks"} # type: ignore + + @distributed_trace_async + async def get(self, fabric_name: str, network_name: str, **kwargs: Any) -> _models.Network: """Gets a network with specified server id and network name. Gets the details of a network. - :param fabric_name: Server Id. + :param fabric_name: Server Id. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Network, or the result of cls(response) + :return: Network or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Network - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Network"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Network] + + request = build_get_request( + fabric_name=fabric_name, + network_name=network_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('Network', pipeline_response) + deserialized = self._deserialize("Network", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}'} # type: ignore - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.NetworkCollection"]: + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Network"]: """Gets the list of networks. View-only API. Lists the networks available in a vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Network or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkCollection"] + _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.NetworkCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkCollection', pipeline_response) + deserialized = self._deserialize("NetworkCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -233,7 +275,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -242,7 +286,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_policies_operations.py index 0dad4bd2b5f0..655f34fe1624 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_policies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,92 +6,122 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_policies_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationPoliciesOperations: - """ReplicationPoliciesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.PolicyCollection"]: + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Policy"]: """Gets the list of replication policies. Lists the replication policies for a vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PolicyCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.PolicyCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Policy or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyCollection"] + _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.PolicyCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PolicyCollection', pipeline_response) + deserialized = self._deserialize("PolicyCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,7 +130,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -108,108 +141,115 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - policy_name: str, - **kwargs: Any - ) -> "_models.Policy": + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies"} # type: ignore + + @distributed_trace_async + async def get(self, policy_name: str, **kwargs: Any) -> _models.Policy: """Gets the requested policy. Gets the details of a replication policy. - :param policy_name: Replication policy name. + :param policy_name: Replication policy name. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Policy, or the result of cls(response) + :return: Policy or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Policy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Policy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Policy] + + request = build_get_request( + policy_name=policy_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('Policy', pipeline_response) + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore async def _create_initial( - self, - policy_name: str, - input: "_models.CreatePolicyInput", - **kwargs: Any - ) -> Optional["_models.Policy"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Policy"]] + self, policy_name: str, input: Union[_models.CreatePolicyInput, IO], **kwargs: Any + ) -> Optional[_models.Policy]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CreatePolicyInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Policy]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "CreatePolicyInput") + + request = build_create_request( + policy_name=policy_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -218,115 +258,188 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Policy', pipeline_response) + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore + + @overload async def begin_create( self, policy_name: str, - input: "_models.CreatePolicyInput", + input: _models.CreatePolicyInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.Policy"]: + ) -> AsyncLROPoller[_models.Policy]: """Creates the policy. The operation to create a replication policy. - :param policy_name: Replication policy name. + :param policy_name: Replication policy name. Required. :type policy_name: str - :param input: Create policy input. + :param input: Create policy input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Policy or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Policy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Policy"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, policy_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Policy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, policy_name: str, input: Union[_models.CreatePolicyInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Policy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Policy] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore policy_name=policy_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Policy', pipeline_response) - + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( - self, - policy_name: str, - **kwargs: Any + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, policy_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + policy_name=policy_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -336,110 +449,114 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore - async def begin_delete( - self, - policy_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + @distributed_trace_async + async def begin_delete(self, policy_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Delete the policy. The operation to delete a replication policy. - :param policy_name: Replication policy name. + :param policy_name: Replication policy name. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore policy_name=policy_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore async def _update_initial( - self, - policy_name: str, - input: "_models.UpdatePolicyInput", - **kwargs: Any - ) -> Optional["_models.Policy"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Policy"]] + self, policy_name: str, input: Union[_models.UpdatePolicyInput, IO], **kwargs: Any + ) -> Optional[_models.Policy]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'UpdatePolicyInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Policy]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "UpdatePolicyInput") + + request = build_update_request( + policy_name=policy_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -448,80 +565,150 @@ async def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Policy', pipeline_response) + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore + + @overload async def begin_update( self, policy_name: str, - input: "_models.UpdatePolicyInput", + input: _models.UpdatePolicyInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.Policy"]: + ) -> AsyncLROPoller[_models.Policy]: """Updates the policy. The operation to update a replication policy. - :param policy_name: Policy Id. + :param policy_name: Policy Id. Required. :type policy_name: str - :param input: Update Policy Input. + :param input: Update Policy Input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Policy or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Policy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Policy"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_update( + self, policy_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param policy_name: Policy Id. Required. + :type policy_name: str + :param input: Update Policy Input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Policy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, policy_name: str, input: Union[_models.UpdatePolicyInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param policy_name: Policy Id. Required. + :type policy_name: str + :param input: Update Policy Input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Policy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Policy] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore policy_name=policy_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Policy', pipeline_response) - + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protectable_items_operations.py index 0c9e0c2dccf5..b310b263f593 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protectable_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,42 +6,57 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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._replication_protectable_items_operations import ( + build_get_request, + build_list_by_replication_protection_containers_request, +) -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationProtectableItemsOperations: - """ReplicationProtectableItemsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationProtectableItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protectable_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protection_containers( self, fabric_name: str, @@ -49,69 +65,81 @@ def list_by_replication_protection_containers( take: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ProtectableItemCollection"]: + ) -> AsyncIterable["_models.ProtectableItem"]: """Gets the list of protectable items. Lists the protectable items in a protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param take: take OData query parameter. + :param take: take OData query parameter. Default value is None. :type take: str - :param skip_token: skipToken OData query parameter. + :param skip_token: skipToken OData query parameter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectableItemCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectableItem or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectableItemCollection"] + _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.ProtectableItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protection_containers.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if take is not None: - query_parameters['$take'] = self._serialize.query("take", take, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protection_containers_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + take=take, + skip_token=skip_token, + api_version=api_version, + template_url=self.list_by_replication_protection_containers.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectableItemCollection', pipeline_response) + deserialized = self._deserialize("ProtectableItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,7 +148,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -129,73 +159,73 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_protection_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_protection_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems"} # type: ignore + @distributed_trace_async async def get( - self, - fabric_name: str, - protection_container_name: str, - protectable_item_name: str, - **kwargs: Any - ) -> "_models.ProtectableItem": + self, fabric_name: str, protection_container_name: str, protectable_item_name: str, **kwargs: Any + ) -> _models.ProtectableItem: """Gets the details of a protectable item. The operation to get the details of a protectable item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param protectable_item_name: Protectable item name. + :param protectable_item_name: Protectable item name. Required. :type protectable_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectableItem, or the result of cls(response) + :return: ProtectableItem or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectableItem"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'protectableItemName': self._serialize.url("protectable_item_name", protectable_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ProtectableItem] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + protectable_item_name=protectable_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('ProtectableItem', pipeline_response) + deserialized = self._deserialize("ProtectableItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protected_items_operations.py index b0284f52c115..1cc2a466de0a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protected_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,148 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_protected_items_operations import ( + build_add_disks_request, + build_apply_recovery_point_request, + build_create_request, + build_delete_request, + build_failover_cancel_request, + build_failover_commit_request, + build_get_request, + build_list_by_replication_protection_containers_request, + build_list_request, + build_planned_failover_request, + build_purge_request, + build_remove_disks_request, + build_repair_replication_request, + build_reprotect_request, + build_resolve_health_errors_request, + build_switch_provider_request, + build_test_failover_cleanup_request, + build_test_failover_request, + build_unplanned_failover_request, + build_update_appliance_request, + build_update_mobility_service_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationProtectedItemsOperations: - """ReplicationProtectedItemsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationProtectedItemsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protected_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protection_containers( - self, - fabric_name: str, - protection_container_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ReplicationProtectedItemCollection"]: + self, fabric_name: str, protection_container_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ReplicationProtectedItem"]: """Gets the list of Replication protected items. Gets the list of ASR replication protected items in the protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationProtectedItemCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItemCollection"] + _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.ReplicationProtectedItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protection_containers.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protection_containers_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_protection_containers.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItemCollection', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,7 +156,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -116,120 +167,130 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_protection_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + list_by_replication_protection_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems"} # type: ignore + + @distributed_trace_async async def get( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - **kwargs: Any - ) -> "_models.ReplicationProtectedItem": + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> _models.ReplicationProtectedItem: """Gets the details of a Replication protected item. Gets the details of an ASR replication protected item. - :param fabric_name: Fabric unique name. + :param fabric_name: Fabric unique name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationProtectedItem, or the result of cls(response) + :return: ReplicationProtectedItem or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ReplicationProtectedItem] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore async def _create_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - input: "_models.EnableProtectionInput", + input: Union[_models.EnableProtectionInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'EnableProtectionInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "EnableProtectionInput") + + request = build_create_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -238,129 +299,218 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore + + @overload async def begin_create( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - input: "_models.EnableProtectionInput", + input: _models.EnableProtectionInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: """Enables protection. The operation to create an ASR replication protected item (Enable replication). - :param fabric_name: Name of the fabric. + :param fabric_name: Name of the fabric. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: A name for the replication protected item. + :param replicated_protected_item_name: A name for the replication protected item. Required. :type replicated_protected_item_name: str - :param input: Enable Protection Input. + :param input: Enable Protection Input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param fabric_name: Name of the fabric. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: A name for the replication protected item. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: Union[_models.EnableProtectionInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param fabric_name: Name of the fabric. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: A name for the replication protected item. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _purge_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - **kwargs: Any + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore + + async def _purge_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_purge_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -370,14 +520,11 @@ async def _purge_initial( if cls: return cls(pipeline_response, None, {}) - _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore + @distributed_trace_async async def begin_purge( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - **kwargs: Any + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Purges protection. @@ -385,111 +532,119 @@ async def begin_purge( the replication protected item. Use the remove operation on replication protected item to perform a clean disable replication for the item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_initial( + raw_result = await self._purge_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore async def _update_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - update_protection_input: "_models.UpdateReplicationProtectedItemInput", + update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_protection_input, 'UpdateReplicationProtectedItemInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_protection_input, (IO, bytes)): + _content = update_protection_input + else: + _json = self._serialize.body(update_protection_input, "UpdateReplicationProtectedItemInput") + + request = build_update_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -498,137 +653,238 @@ async def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore + + @overload async def begin_update( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - update_protection_input: "_models.UpdateReplicationProtectedItemInput", + update_protection_input: _models.UpdateReplicationProtectedItemInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: """Updates the replication protected item settings. The operation to update the recovery settings of an ASR replication protected item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param update_protection_input: Update protection input. - :type update_protection_input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput + :param update_protection_input: Update protection input. Required. + :type update_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_update( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Required. + :type update_protection_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Is either a model type or a IO type. + Required. + :type update_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, update_protection_input=update_protection_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore async def _add_disks_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - add_disks_input: "_models.AddDisksInput", + add_disks_input: Union[_models.AddDisksInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._add_disks_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(add_disks_input, 'AddDisksInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(add_disks_input, (IO, bytes)): + _content = add_disks_input + else: + _json = self._serialize.body(add_disks_input, "AddDisksInput") + + request = build_add_disks_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._add_disks_initial.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, 202]: @@ -637,270 +893,235 @@ async def _add_disks_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _add_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks'} # type: ignore + _add_disks_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks"} # type: ignore + + @overload async def begin_add_disks( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - add_disks_input: "_models.AddDisksInput", + add_disks_input: _models.AddDisksInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: """Add disk(s) for protection. Operation to add disks(s) to the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param add_disks_input: Add disks input. + :param add_disks_input: Add disks input. Required. :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._add_disks_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - add_disks_input=add_disks_input, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_add_disks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks'} # type: ignore - async def _apply_recovery_point_initial( + @overload + async def begin_add_disks( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - apply_recovery_point_input: "_models.ApplyRecoveryPointInput", + add_disks_input: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._apply_recovery_point_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(apply_recovery_point_input, 'ApplyRecoveryPointInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. - if cls: - return cls(pipeline_response, deserialized, {}) + Operation to add disks(s) to the replication protected item. - return deserialized - _apply_recovery_point_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint'} # type: ignore + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Required. + :type add_disks_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ - async def begin_apply_recovery_point( + @distributed_trace_async + async def begin_add_disks( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - apply_recovery_point_input: "_models.ApplyRecoveryPointInput", + add_disks_input: Union[_models.AddDisksInput, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: - """Change or apply recovery point. + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. - The operation to change the recovery point of a failed over replication protected item. + Operation to add disks(s) to the replication protected item. - :param fabric_name: The ARM fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: The protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: The replicated protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param apply_recovery_point_input: The ApplyRecoveryPointInput. - :type apply_recovery_point_input: ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput + :param add_disks_input: Add disks input. Is either a model type or a IO type. Required. + :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[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", 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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._apply_recovery_point_initial( + raw_result = await self._add_disks_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - apply_recovery_point_input=apply_recovery_point_input, - cls=lambda x,y,z: x, + add_disks_input=add_disks_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_apply_recovery_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _failover_cancel_initial( + begin_add_disks.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks"} # type: ignore + + async def _apply_recovery_point_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, + apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._failover_cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apply_recovery_point_input, (IO, bytes)): + _content = apply_recovery_point_input + else: + _json = self._serialize.body(apply_recovery_point_input, "ApplyRecoveryPointInput") + + request = build_apply_recovery_point_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._apply_recovery_point_initial.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 + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -909,127 +1130,955 @@ async def _failover_cancel_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _failover_cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel'} # type: ignore - async def begin_failover_cancel( + _apply_recovery_point_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint"} # type: ignore + + @overload + async def begin_apply_recovery_point( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, + apply_recovery_point_input: _models.ApplyRecoveryPointInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: - """Execute cancel failover. + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. - Operation to cancel the failover of the replication protected item. + The operation to change the recovery point of a failed over replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: The ARM fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: The protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: The replicated protected item name. Required. :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._failover_cancel_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, + + @overload + async def begin_apply_recovery_point( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param fabric_name: The ARM fabric name. Required. + :type fabric_name: str + :param protection_container_name: The protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The replicated protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_apply_recovery_point( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param fabric_name: The ARM fabric name. Required. + :type fabric_name: str + :param protection_container_name: The protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The replicated protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Is either a model type or a IO + type. Required. + :type apply_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._apply_recovery_point_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + apply_recovery_point_input=apply_recovery_point_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_apply_recovery_point.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint"} # type: ignore + + async def _failover_cancel_initial( + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: + 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[Optional[_models.ReplicationProtectedItem]] + + request = build_failover_cancel_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._failover_cancel_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _failover_cancel_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel"} # type: ignore + + @distributed_trace_async + async def begin_failover_cancel( + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute cancel failover. + + Operation to cancel the failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._failover_cancel_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_failover_cancel.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel"} # type: ignore + + async def _failover_commit_initial( + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: + 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[Optional[_models.ReplicationProtectedItem]] + + request = build_failover_commit_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._failover_commit_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _failover_commit_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit"} # type: ignore + + @distributed_trace_async + async def begin_failover_commit( + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute commit failover. + + Operation to commit the failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._failover_commit_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_failover_commit.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit"} # type: ignore + + async def _planned_failover_initial( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.PlannedFailoverInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(failover_input, (IO, bytes)): + _content = failover_input + else: + _json = self._serialize.body(failover_input, "PlannedFailoverInput") + + request = build_planned_failover_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._planned_failover_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _planned_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover"} # type: ignore + + @overload + async def begin_planned_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: _models.PlannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_planned_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Required. + :type failover_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_planned_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.PlannedFailoverInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Is either a model type or a IO type. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._planned_failover_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + failover_input=failover_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_planned_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: Union[_models.DisableProtectionInput, IO], + **kwargs: Any + ) -> None: + 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[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(disable_protection_input, (IO, bytes)): + _content = disable_protection_input + else: + _json = self._serialize.body(disable_protection_input, "DisableProtectionInput") + + request = build_delete_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_initial.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 [202, 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_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove"} # type: ignore + + @overload + async def begin_delete( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: _models.DisableProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_delete( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_delete( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: Union[_models.DisableProtectionInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Is either a model type or a IO type. + Required. + :type disable_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - cls=lambda x,y,z: x, + disable_protection_input=disable_protection_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } + return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_failover_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _failover_commit_initial( + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove"} # type: ignore + + async def _remove_disks_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, + remove_disks_input: Union[_models.RemoveDisksInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._failover_commit_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(remove_disks_input, (IO, bytes)): + _content = remove_disks_input + else: + _json = self._serialize.body(remove_disks_input, "RemoveDisksInput") + + request = build_remove_disks_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._remove_disks_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1038,133 +2087,362 @@ async def _failover_commit_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _failover_commit_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit'} # type: ignore - async def begin_failover_commit( + _remove_disks_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks"} # type: ignore + + @overload + async def begin_remove_disks( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, + remove_disks_input: _models.RemoveDisksInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: - """Execute commit failover. + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). - Operation to commit the failover of the replication protected item. + Operation to remove disk(s) from the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Required. + :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_remove_disks( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Required. + :type remove_disks_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_remove_disks( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: Union[_models.RemoveDisksInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Is either a model type or a IO type. Required. + :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._failover_commit_initial( + raw_result = await self._remove_disks_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - cls=lambda x,y,z: x, + remove_disks_input=remove_disks_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_remove_disks.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks"} # type: ignore + + async def _repair_replication_initial( + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: + 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[Optional[_models.ReplicationProtectedItem]] + + request = build_repair_replication_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._repair_replication_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _repair_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication"} # type: ignore + + @distributed_trace_async + async def begin_repair_replication( + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Resynchronize or repair replication. + + The operation to start resynchronize/repair replication for a replication protected item + requiring resynchronization. + + :param fabric_name: The name of the fabric. Required. + :type fabric_name: str + :param protection_container_name: The name of the container. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the replication protected item. Required. + :type replicated_protected_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._repair_replication_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_failover_commit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _planned_failover_initial( + begin_repair_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication"} # type: ignore + + async def _reprotect_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - failover_input: "_models.PlannedFailoverInput", + reprotect_input: Union[_models.ReverseReplicationInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._planned_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(failover_input, 'PlannedFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(reprotect_input, (IO, bytes)): + _content = reprotect_input + else: + _json = self._serialize.body(reprotect_input, "ReverseReplicationInput") + + request = build_reprotect_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reprotect_initial.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, 202]: @@ -1173,400 +2451,476 @@ async def _planned_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _planned_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover'} # type: ignore - async def begin_planned_failover( + _reprotect_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect"} # type: ignore + + @overload + async def begin_reprotect( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: _models.ReverseReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Required. + :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reprotect( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Required. + :type reprotect_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reprotect( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - failover_input: "_models.PlannedFailoverInput", + reprotect_input: Union[_models.ReverseReplicationInput, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: - """Execute planned failover. + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\Reprotect. - Operation to initiate a planned failover of the replication protected item. + Operation to reprotect or reverse replicate a failed over replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param failover_input: Planned failover input. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput + :param reprotect_input: Reverse replication input. Is either a model type or a IO type. + Required. + :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[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", 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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._planned_failover_initial( + raw_result = await self._reprotect_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - failover_input=failover_input, - cls=lambda x,y,z: x, + reprotect_input=reprotect_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_planned_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_reprotect.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect"} # type: ignore + + async def _resolve_health_errors_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - disable_protection_input: "_models.DisableProtectionInput", + resolve_health_input: Union[_models.ResolveHealthInput, IO], **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + 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[Optional[_models.ReplicationProtectedItem]] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resolve_health_input, (IO, bytes)): + _content = resolve_health_input + else: + _json = self._serialize.body(resolve_health_input, "ResolveHealthInput") + + request = build_resolve_health_errors_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resolve_health_errors_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disable_protection_input, 'DisableProtectionInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove'} # type: ignore + return deserialized - async def begin_delete( + _resolve_health_errors_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors"} # type: ignore + + @overload + async def begin_resolve_health_errors( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - disable_protection_input: "_models.DisableProtectionInput", + resolve_health_input: _models.ResolveHealthInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disables protection. + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. - The operation to disable replication on a replication protected item. This will also remove the - item. + Operation to resolve health issues of the replication protected item. - :param fabric_name: Fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param disable_protection_input: Disable protection input. - :type disable_protection_input: ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput + :param resolve_health_input: Health issue input object. Required. + :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - disable_protection_input=disable_protection_input, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove'} # type: ignore - async def _remove_disks_initial( + @overload + async def begin_resolve_health_errors( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - remove_disks_input: "_models.RemoveDisksInput", + resolve_health_input: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._remove_disks_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(remove_disks_input, 'RemoveDisksInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. - if cls: - return cls(pipeline_response, deserialized, {}) + Operation to resolve health issues of the replication protected item. - return deserialized - _remove_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks'} # type: ignore + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Required. + :type resolve_health_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ - async def begin_remove_disks( + @distributed_trace_async + async def begin_resolve_health_errors( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - remove_disks_input: "_models.RemoveDisksInput", + resolve_health_input: Union[_models.ResolveHealthInput, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: - """Removes disk(s). + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. - Operation to remove disk(s) from the replication protected item. + Operation to resolve health issues of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param remove_disks_input: Remove disks input. - :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput + :param resolve_health_input: Health issue input object. Is either a model type or a IO type. + Required. + :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[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", 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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._remove_disks_initial( + raw_result = await self._resolve_health_errors_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - remove_disks_input=remove_disks_input, - cls=lambda x,y,z: x, + resolve_health_input=resolve_health_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_remove_disks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _repair_replication_initial( + begin_resolve_health_errors.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors"} # type: ignore + + async def _switch_provider_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, + switch_provider_input: Union[_models.SwitchProviderInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._repair_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, '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", 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.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(switch_provider_input, (IO, bytes)): + _content = switch_provider_input + else: + _json = self._serialize.body(switch_provider_input, "SwitchProviderInput") + + request = build_switch_provider_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._switch_provider_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1575,273 +2929,241 @@ async def _repair_replication_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _repair_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication'} # type: ignore - async def begin_repair_replication( + _switch_provider_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider"} # type: ignore + + @overload + async def begin_switch_provider( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, + switch_provider_input: _models.SwitchProviderInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: - """Resynchronize or repair replication. + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. - The operation to start resynchronize/repair replication for a replication protected item - requiring resynchronization. + Operation to initiate a switch provider of the replication protected item. - :param fabric_name: The name of the fabric. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: The name of the container. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: The name of the replication protected item. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._repair_replication_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_repair_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication'} # type: ignore - async def _reprotect_initial( + @overload + async def begin_switch_provider( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - reprotect_input: "_models.ReverseReplicationInput", + switch_provider_input: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reprotect_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(reprotect_input, 'ReverseReplicationInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. - if cls: - return cls(pipeline_response, deserialized, {}) + Operation to initiate a switch provider of the replication protected item. - return deserialized - _reprotect_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect'} # type: ignore + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ - async def begin_reprotect( + @distributed_trace_async + async def begin_switch_provider( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - reprotect_input: "_models.ReverseReplicationInput", + switch_provider_input: Union[_models.SwitchProviderInput, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: - """Execute Reverse Replication\Reprotect. + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. - Operation to reprotect or reverse replicate a failed over replication protected item. + Operation to initiate a switch provider of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param reprotect_input: Reverse replication input. - :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput + :param switch_provider_input: Switch provider input. Is either a model type or a IO type. + Required. + :type switch_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[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", 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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._reprotect_initial( + raw_result = await self._switch_provider_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - reprotect_input=reprotect_input, - cls=lambda x,y,z: x, + switch_provider_input=switch_provider_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reprotect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _resolve_health_errors_initial( + begin_switch_provider.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider"} # type: ignore + + async def _test_failover_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - resolve_health_input: "_models.ResolveHealthInput", + testfailover_input: Union[_models.TestFailoverInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._resolve_health_errors_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resolve_health_input, 'ResolveHealthInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(testfailover_input, (IO, bytes)): + _content = testfailover_input + else: + _json = self._serialize.body(testfailover_input, "TestFailoverInput") + + request = build_test_failover_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_failover_initial.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, 202]: @@ -1850,276 +3172,236 @@ async def _resolve_health_errors_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _resolve_health_errors_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors'} # type: ignore - async def begin_resolve_health_errors( + _test_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover"} # type: ignore + + @overload + async def begin_test_failover( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - resolve_health_input: "_models.ResolveHealthInput", + testfailover_input: _models.TestFailoverInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: - """Resolve health errors. + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. - Operation to resolve health issues of the replication protected item. + Operation to perform a test failover of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param resolve_health_input: Health issue input object. - :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput + :param testfailover_input: Test failover input. Required. + :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._resolve_health_errors_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resolve_health_input=resolve_health_input, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_resolve_health_errors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors'} # type: ignore - async def _test_failover_initial( + @overload + async def begin_test_failover( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - testfailover_input: "_models.TestFailoverInput", + testfailover_input: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(testfailover_input, 'TestFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. - if cls: - return cls(pipeline_response, deserialized, {}) + Operation to perform a test failover of the replication protected item. - return deserialized - _test_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover'} # type: ignore + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Required. + :type testfailover_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async async def begin_test_failover( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - testfailover_input: "_models.TestFailoverInput", + testfailover_input: Union[_models.TestFailoverInput, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: """Execute test failover. Operation to perform a test failover of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param testfailover_input: Test failover input. - :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput + :param testfailover_input: Test failover input. Is either a model type or a IO type. Required. + :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[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", 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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._test_failover_initial( + raw_result = await self._test_failover_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, testfailover_input=testfailover_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover"} # type: ignore async def _test_failover_cleanup_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - cleanup_input: "_models.TestFailoverCleanupInput", + cleanup_input: Union[_models.TestFailoverCleanupInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_failover_cleanup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cleanup_input, 'TestFailoverCleanupInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cleanup_input, (IO, bytes)): + _content = cleanup_input + else: + _json = self._serialize.body(cleanup_input, "TestFailoverCleanupInput") + + request = build_test_failover_cleanup_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_failover_cleanup_initial.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, 202]: @@ -2128,137 +3410,237 @@ async def _test_failover_cleanup_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_failover_cleanup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup'} # type: ignore + _test_failover_cleanup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup"} # type: ignore + + @overload async def begin_test_failover_cleanup( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - cleanup_input: "_models.TestFailoverCleanupInput", + cleanup_input: _models.TestFailoverCleanupInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: """Execute test failover cleanup. Operation to clean up the test failover of a replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param cleanup_input: Test failover cleanup input. + :param cleanup_input: Test failover cleanup input. Required. :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_test_failover_cleanup( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_failover_cleanup( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: Union[_models.TestFailoverCleanupInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Is either a model type or a IO type. + Required. + :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._test_failover_cleanup_initial( + raw_result = await self._test_failover_cleanup_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, cleanup_input=cleanup_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_failover_cleanup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_failover_cleanup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup"} # type: ignore async def _unplanned_failover_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - failover_input: "_models.UnplannedFailoverInput", + failover_input: Union[_models.UnplannedFailoverInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._unplanned_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(failover_input, 'UnplannedFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(failover_input, (IO, bytes)): + _content = failover_input + else: + _json = self._serialize.body(failover_input, "UnplannedFailoverInput") + + request = build_unplanned_failover_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._unplanned_failover_initial.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, 202]: @@ -2267,137 +3649,236 @@ async def _unplanned_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _unplanned_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover'} # type: ignore + _unplanned_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover"} # type: ignore + + @overload async def begin_unplanned_failover( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - failover_input: "_models.UnplannedFailoverInput", + failover_input: _models.UnplannedFailoverInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: """Execute unplanned failover. Operation to initiate a failover of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param failover_input: Failover input. + :param failover_input: Failover input. Required. :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_unplanned_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Required. + :type failover_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_unplanned_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.UnplannedFailoverInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Is either a model type or a IO type. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._unplanned_failover_initial( + raw_result = await self._unplanned_failover_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, failover_input=failover_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_unplanned_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_unplanned_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover"} # type: ignore async def _update_appliance_initial( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - appliance_update_input: "_models.UpdateApplianceForReplicationProtectedItemInput", + appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_appliance_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(appliance_update_input, 'UpdateApplianceForReplicationProtectedItemInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(appliance_update_input, (IO, bytes)): + _content = appliance_update_input + else: + _json = self._serialize.body(appliance_update_input, "UpdateApplianceForReplicationProtectedItemInput") + + request = build_update_appliance_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_appliance_initial.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, 202]: @@ -2406,137 +3887,239 @@ async def _update_appliance_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_appliance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance'} # type: ignore + _update_appliance_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance"} # type: ignore + + @overload async def begin_update_appliance( self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, - appliance_update_input: "_models.UpdateApplianceForReplicationProtectedItemInput", + appliance_update_input: _models.UpdateApplianceForReplicationProtectedItemInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: """Updates appliance for replication protected Item. The operation to update appliance of an ASR replication protected item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param appliance_update_input: Appliance update protection input. - :type appliance_update_input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_update_appliance( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_appliance( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Is either a model type or a + IO type. Required. + :type appliance_update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_appliance_initial( + raw_result = await self._update_appliance_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, appliance_update_input=appliance_update_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_appliance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_appliance.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance"} # type: ignore async def _update_mobility_service_initial( self, fabric_name: str, protection_container_name: str, - replication_protected_item_name: str, - update_mobility_service_request: "_models.UpdateMobilityServiceRequest", + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, IO], **kwargs: Any - ) -> Optional["_models.ReplicationProtectedItem"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_mobility_service_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicationProtectedItemName': self._serialize.url("replication_protected_item_name", replication_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_mobility_service_request, 'UpdateMobilityServiceRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_mobility_service_request, (IO, bytes)): + _content = update_mobility_service_request + else: + _json = self._serialize.body(update_mobility_service_request, "UpdateMobilityServiceRequest") + + request = build_update_mobility_service_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_mobility_service_initial.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, 202]: @@ -2545,156 +4128,267 @@ async def _update_mobility_service_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_mobility_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicationProtectedItemName}/updateMobilityService'} # type: ignore + _update_mobility_service_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService"} # type: ignore + + @overload + async def begin_update_mobility_service( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: _models.UpdateMobilityServiceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param fabric_name: The name of the fabric containing the protected item. Required. + :type fabric_name: str + :param protection_container_name: The name of the container containing the protected item. + Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload async def begin_update_mobility_service( self, fabric_name: str, protection_container_name: str, - replication_protected_item_name: str, - update_mobility_service_request: "_models.UpdateMobilityServiceRequest", + replicated_protected_item_name: str, + update_mobility_service_request: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ReplicationProtectedItem"]: + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: """Update the mobility service on a protected item. The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version. - :param fabric_name: The name of the fabric containing the protected item. + :param fabric_name: The name of the fabric containing the protected item. Required. :type fabric_name: str :param protection_container_name: The name of the container containing the protected item. + Required. :type protection_container_name: str - :param replication_protected_item_name: The name of the protected item on which the agent is to - be updated. - :type replication_protected_item_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str :param update_mobility_service_request: Request to update the mobility service on the protected - item. - :type update_mobility_service_request: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest + item. Required. + :type update_mobility_service_request: 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 :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @distributed_trace_async + async def begin_update_mobility_service( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param fabric_name: The name of the fabric containing the protected item. Required. + :type fabric_name: str + :param protection_container_name: The name of the container containing the protected item. + Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Is either a model type or a IO type. Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_mobility_service_initial( + raw_result = await self._update_mobility_service_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, - replication_protected_item_name=replication_protected_item_name, + replicated_protected_item_name=replicated_protected_item_name, update_mobility_service_request=update_mobility_service_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicationProtectedItemName': self._serialize.url("replication_protected_item_name", replication_protected_item_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_mobility_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicationProtectedItemName}/updateMobilityService'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_mobility_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService"} # type: ignore + + @distributed_trace def list( - self, - skip_token: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ReplicationProtectedItemCollection"]: + self, skip_token: Optional[str] = None, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ReplicationProtectedItem"]: """Gets the list of replication protected items. Gets the list of ASR replication protected items in the vault. :param skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or - null. + null. Default value is None. :type skip_token: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationProtectedItemCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItemCollection"] + _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.ReplicationProtectedItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItemCollection', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -2703,7 +4397,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -2712,7 +4408,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_container_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_container_mappings_operations.py index e15f3a0ee80f..5927bb47df65 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_container_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_container_mappings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,133 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_protection_container_mappings_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_replication_protection_containers_request, + build_list_request, + build_purge_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationProtectionContainerMappingsOperations: - """ReplicationProtectionContainerMappingsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationProtectionContainerMappingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protection_container_mappings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protection_containers( - self, - fabric_name: str, - protection_container_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ProtectionContainerMappingCollection"]: + self, fabric_name: str, protection_container_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ProtectionContainerMapping"]: """Gets the list of protection container mappings for a protection container. Lists the protection container mappings for a protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerMappingCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectionContainerMapping or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMappingCollection"] + _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.ProtectionContainerMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protection_containers.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protection_containers_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_protection_containers.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectionContainerMappingCollection', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,7 +141,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -116,120 +152,130 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_protection_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_protection_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings"} # type: ignore + @distributed_trace_async async def get( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - **kwargs: Any - ) -> "_models.ProtectionContainerMapping": + self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any + ) -> _models.ProtectionContainerMapping: """Gets a protection container mapping. Gets the details of a protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection Container mapping name. + :param mapping_name: Protection Container mapping name. Required. :type mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainerMapping, or the result of cls(response) + :return: ProtectionContainerMapping or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMapping"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ProtectionContainerMapping] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('ProtectionContainerMapping', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore async def _create_initial( self, fabric_name: str, protection_container_name: str, mapping_name: str, - creation_input: "_models.CreateProtectionContainerMappingInput", + creation_input: Union[_models.CreateProtectionContainerMappingInput, IO], **kwargs: Any - ) -> Optional["_models.ProtectionContainerMapping"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainerMapping"]] + ) -> Optional[_models.ProtectionContainerMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(creation_input, 'CreateProtectionContainerMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainerMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(creation_input, (IO, bytes)): + _content = creation_input + else: + _json = self._serialize.body(creation_input, "CreateProtectionContainerMappingInput") + + request = build_create_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -238,129 +284,220 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainerMapping', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore + + @overload async def begin_create( self, fabric_name: str, protection_container_name: str, mapping_name: str, - creation_input: "_models.CreateProtectionContainerMappingInput", + creation_input: _models.CreateProtectionContainerMappingInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ProtectionContainerMapping"]: + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: """Create protection container mapping. The operation to create a protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection container mapping name. + :param mapping_name: Protection container mapping name. Required. :type mapping_name: str - :param creation_input: Mapping creation input. - :type creation_input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput + :param creation_input: Mapping creation input. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Required. + :type creation_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: Union[_models.CreateProtectionContainerMappingInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Is either a model type or a IO type. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainerMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, mapping_name=mapping_name, creation_input=creation_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainerMapping', pipeline_response) - + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _purge_initial( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - **kwargs: Any + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore + + async def _purge_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_purge_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -370,124 +507,129 @@ async def _purge_initial( if cls: return cls(pipeline_response, None, {}) - _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore + @distributed_trace_async async def begin_purge( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - **kwargs: Any + self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Purge protection container mapping. The operation to purge(force delete) a protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection container mapping name. + :param mapping_name: Protection container mapping name. Required. :type mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_initial( + raw_result = await self._purge_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, mapping_name=mapping_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore async def _update_initial( self, fabric_name: str, protection_container_name: str, mapping_name: str, - update_input: "_models.UpdateProtectionContainerMappingInput", + update_input: Union[_models.UpdateProtectionContainerMappingInput, IO], **kwargs: Any - ) -> Optional["_models.ProtectionContainerMapping"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainerMapping"]] + ) -> Optional[_models.ProtectionContainerMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_input, 'UpdateProtectionContainerMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainerMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_input, (IO, bytes)): + _content = update_input + else: + _json = self._serialize.body(update_input, "UpdateProtectionContainerMappingInput") + + request = build_update_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -496,135 +638,237 @@ async def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainerMapping', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore + + @overload async def begin_update( self, fabric_name: str, protection_container_name: str, mapping_name: str, - update_input: "_models.UpdateProtectionContainerMappingInput", + update_input: _models.UpdateProtectionContainerMappingInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ProtectionContainerMapping"]: + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: """Update protection container mapping. The operation to update protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection container mapping name. + :param mapping_name: Protection container mapping name. Required. :type mapping_name: str - :param update_input: Mapping update input. - :type update_input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput + :param update_input: Mapping update input. Required. + :type update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_update( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Required. + :type update_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: Union[_models.UpdateProtectionContainerMappingInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Is either a model type or a IO type. Required. + :type update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainerMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, mapping_name=mapping_name, update_input=update_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainerMapping', pipeline_response) - + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, fabric_name: str, protection_container_name: str, mapping_name: str, - removal_input: "_models.RemoveProtectionContainerMappingInput", + removal_input: Union[_models.RemoveProtectionContainerMappingInput, IO], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(removal_input, (IO, bytes)): + _content = removal_input + else: + _json = self._serialize.body(removal_input, "RemoveProtectionContainerMappingInput") + + request = build_delete_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(removal_input, 'RemoveProtectionContainerMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -634,133 +878,231 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove"} # type: ignore + @overload async def begin_delete( self, fabric_name: str, protection_container_name: str, mapping_name: str, - removal_input: "_models.RemoveProtectionContainerMappingInput", + removal_input: _models.RemoveProtectionContainerMappingInput, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Remove protection container mapping. The operation to delete or remove a protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection container mapping name. + :param mapping_name: Protection container mapping name. Required. :type mapping_name: str - :param removal_input: Removal input. - :type removal_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput + :param removal_input: Removal input. Required. + :type removal_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_delete( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Required. + :type removal_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_delete( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: Union[_models.RemoveProtectionContainerMappingInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Is either a model type or a IO type. Required. + :type removal_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, mapping_name=mapping_name, removal_input=removal_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ProtectionContainerMappingCollection"]: + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ProtectionContainerMapping"]: """Gets the list of all protection container mappings in a vault. Lists the protection container mappings in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerMappingCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectionContainerMapping or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMappingCollection"] + _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.ProtectionContainerMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectionContainerMappingCollection', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -769,7 +1111,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -778,7 +1122,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_containers_operations.py index 84a5ae45062f..551a0e36b65a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_containers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,96 +6,129 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_protection_containers_operations import ( + build_create_request, + build_delete_request, + build_discover_protectable_item_request, + build_get_request, + build_list_by_replication_fabrics_request, + build_list_request, + build_switch_protection_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationProtectionContainersOperations: - """ReplicationProtectionContainersOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationProtectionContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protection_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_fabrics( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ProtectionContainerCollection"]: + self, fabric_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ProtectionContainer"]: """Gets the list of protection container for a fabric. Lists the protection containers in the specified fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectionContainer or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerCollection"] + _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.ProtectionContainerCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectionContainerCollection', pipeline_response) + deserialized = self._deserialize("ProtectionContainerCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,7 +137,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -112,114 +148,123 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - fabric_name: str, - protection_container_name: str, - **kwargs: Any - ) -> "_models.ProtectionContainer": + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers"} # type: ignore + + @distributed_trace_async + async def get(self, fabric_name: str, protection_container_name: str, **kwargs: Any) -> _models.ProtectionContainer: """Gets the protection container details. Gets the details of a protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainer, or the result of cls(response) + :return: ProtectionContainer or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainer"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ProtectionContainer] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('ProtectionContainer', pipeline_response) + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}"} # type: ignore async def _create_initial( self, fabric_name: str, protection_container_name: str, - creation_input: "_models.CreateProtectionContainerInput", + creation_input: Union[_models.CreateProtectionContainerInput, IO], **kwargs: Any - ) -> Optional["_models.ProtectionContainer"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainer"]] + ) -> Optional[_models.ProtectionContainer]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(creation_input, 'CreateProtectionContainerInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainer]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(creation_input, (IO, bytes)): + _content = creation_input + else: + _json = self._serialize.body(creation_input, "CreateProtectionContainerInput") + + request = build_create_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -228,130 +273,225 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainer', pipeline_response) + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}"} # type: ignore + + @overload async def begin_create( self, fabric_name: str, protection_container_name: str, - creation_input: "_models.CreateProtectionContainerInput", + creation_input: _models.CreateProtectionContainerInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ProtectionContainer"]: + ) -> AsyncLROPoller[_models.ProtectionContainer]: """Create a protection container. Operation to create a protection container. - :param fabric_name: Unique fabric ARM name. + :param fabric_name: Unique fabric ARM name. Required. :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. + :param protection_container_name: Unique protection container ARM name. Required. :type protection_container_name: str - :param creation_input: Creation input. - :type creation_input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput + :param creation_input: Creation input. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainer"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, + fabric_name: str, + protection_container_name: str, + creation_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param fabric_name: Unique fabric ARM name. Required. + :type fabric_name: str + :param protection_container_name: Unique protection container ARM name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Required. + :type creation_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + fabric_name: str, + protection_container_name: str, + creation_input: Union[_models.CreateProtectionContainerInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param fabric_name: Unique fabric ARM name. Required. + :type fabric_name: str + :param protection_container_name: Unique protection container ARM name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Is either a model type or a IO type. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainer] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, creation_input=creation_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainer', pipeline_response) - + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}"} # type: ignore async def _discover_protectable_item_initial( self, fabric_name: str, protection_container_name: str, - discover_protectable_item_request: "_models.DiscoverProtectableItemRequest", + discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, IO], **kwargs: Any - ) -> Optional["_models.ProtectionContainer"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainer"]] + ) -> Optional[_models.ProtectionContainer]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._discover_protectable_item_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(discover_protectable_item_request, 'DiscoverProtectableItemRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainer]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(discover_protectable_item_request, (IO, bytes)): + _content = discover_protectable_item_request + else: + _json = self._serialize.body(discover_protectable_item_request, "DiscoverProtectableItemRequest") + + request = build_discover_protectable_item_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._discover_protectable_item_initial.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, 202]: @@ -360,122 +500,212 @@ async def _discover_protectable_item_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainer', pipeline_response) + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _discover_protectable_item_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem'} # type: ignore + _discover_protectable_item_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem"} # type: ignore + + @overload async def begin_discover_protectable_item( self, fabric_name: str, protection_container_name: str, - discover_protectable_item_request: "_models.DiscoverProtectableItemRequest", + discover_protectable_item_request: _models.DiscoverProtectableItemRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ProtectionContainer"]: + ) -> AsyncLROPoller[_models.ProtectionContainer]: """Adds a protectable item to the replication protection container. The operation to a add a protectable item to a protection container(Add physical server). - :param fabric_name: The name of the fabric. + :param fabric_name: The name of the fabric. Required. :type fabric_name: str - :param protection_container_name: The name of the protection container. + :param protection_container_name: The name of the protection container. Required. :type protection_container_name: str :param discover_protectable_item_request: The request object to add a protectable item. - :type discover_protectable_item_request: ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest + Required. + :type discover_protectable_item_request: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainer"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_discover_protectable_item( + self, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param fabric_name: The name of the fabric. Required. + :type fabric_name: str + :param protection_container_name: The name of the protection container. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. + Required. + :type discover_protectable_item_request: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_discover_protectable_item( + self, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param fabric_name: The name of the fabric. Required. + :type fabric_name: str + :param protection_container_name: The name of the protection container. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. Is + either a model type or a IO type. Required. + :type discover_protectable_item_request: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainer] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._discover_protectable_item_initial( + raw_result = await self._discover_protectable_item_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, discover_protectable_item_request=discover_protectable_item_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainer', pipeline_response) - + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_discover_protectable_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( - self, - fabric_name: str, - protection_container_name: str, - **kwargs: Any + begin_discover_protectable_item.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, protection_container_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -485,117 +715,124 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove"} # type: ignore + @distributed_trace_async async def begin_delete( - self, - fabric_name: str, - protection_container_name: str, - **kwargs: Any + self, fabric_name: str, protection_container_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Removes a protection container. Operation to remove a protection container. - :param fabric_name: Unique fabric ARM name. + :param fabric_name: Unique fabric ARM name. Required. :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. + :param protection_container_name: Unique protection container ARM name. Required. :type protection_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove"} # type: ignore async def _switch_protection_initial( self, fabric_name: str, protection_container_name: str, - switch_input: "_models.SwitchProtectionInput", + switch_input: Union[_models.SwitchProtectionInput, IO], **kwargs: Any - ) -> Optional["_models.ProtectionContainer"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainer"]] + ) -> Optional[_models.ProtectionContainer]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._switch_protection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(switch_input, 'SwitchProtectionInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainer]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(switch_input, (IO, bytes)): + _content = switch_input + else: + _json = self._serialize.body(switch_input, "SwitchProtectionInput") + + request = build_switch_protection_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._switch_protection_initial.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, 202]: @@ -604,138 +841,236 @@ async def _switch_protection_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainer', pipeline_response) + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _switch_protection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection'} # type: ignore + _switch_protection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection"} # type: ignore + + @overload async def begin_switch_protection( self, fabric_name: str, protection_container_name: str, - switch_input: "_models.SwitchProtectionInput", + switch_input: _models.SwitchProtectionInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.ProtectionContainer"]: + ) -> AsyncLROPoller[_models.ProtectionContainer]: """Switches protection from one container to another or one replication provider to another. Operation to switch protection from one container to another or one replication provider to another. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param switch_input: Switch protection input. + :param switch_input: Switch protection input. Required. :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainer"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_switch_protection( + self, + fabric_name: str, + protection_container_name: str, + switch_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_switch_protection( + self, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchProtectionInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Is either a model type or a IO type. Required. + :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainer] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._switch_protection_initial( + raw_result = await self._switch_protection_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, switch_input=switch_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainer', pipeline_response) - + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_switch_protection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ProtectionContainerCollection"]: + begin_switch_protection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ProtectionContainer"]: """Gets the list of all protection containers in a vault. Lists the protection containers in a vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectionContainer or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerCollection"] + _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.ProtectionContainerCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectionContainerCollection', pipeline_response) + deserialized = self._deserialize("ProtectionContainerCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -744,7 +1079,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -753,7 +1090,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_intents_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_intents_operations.py index c52d56cdbd00..d2b5c5a242ac 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_intents_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_intents_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,127 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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 - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_protection_intents_operations import ( + build_create_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationProtectionIntentsOperations: - """ReplicationProtectionIntentsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationProtectionIntentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protection_intents` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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, - skip_token: Optional[str] = None, - take_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ReplicationProtectionIntentCollection"]: + self, skip_token: Optional[str] = None, take_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ReplicationProtectionIntent"]: """Gets the list of replication protection intent objects. Gets the list of ASR replication protection intent objects in the vault. - :param skip_token: The pagination token. + :param skip_token: The pagination token. Default value is None. :type skip_token: str - :param take_token: The page size. + :param take_token: The page size. Default value is None. :type take_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationProtectionIntentCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ReplicationProtectionIntent or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectionIntentCollection"] + _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.ReplicationProtectionIntentCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if take_token is not None: - query_parameters['takeToken'] = self._serialize.query("take_token", take_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + 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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationProtectionIntentCollection', pipeline_response) + deserialized = self._deserialize("ReplicationProtectionIntentCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,7 +135,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -116,131 +146,190 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - intent_object_name: str, - **kwargs: Any - ) -> "_models.ReplicationProtectionIntent": + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents"} # type: ignore + + @distributed_trace_async + async def get(self, intent_object_name: str, **kwargs: Any) -> _models.ReplicationProtectionIntent: """Gets the details of a Replication protection intent item. Gets the details of an ASR replication protection intent. - :param intent_object_name: Replication protection intent name. + :param intent_object_name: Replication protection intent name. Required. :type intent_object_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationProtectionIntent, or the result of cls(response) + :return: ReplicationProtectionIntent or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectionIntent"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'intentObjectName': self._serialize.url("intent_object_name", intent_object_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ReplicationProtectionIntent] + + request = build_get_request( + intent_object_name=intent_object_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('ReplicationProtectionIntent', pipeline_response) + deserialized = self._deserialize("ReplicationProtectionIntent", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}'} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}"} # type: ignore + + @overload async def create( self, intent_object_name: str, - input: "_models.CreateProtectionIntentInput", + input: _models.CreateProtectionIntentInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.ReplicationProtectionIntent": + ) -> _models.ReplicationProtectionIntent: """Create protection intent Resource. The operation to create an ASR replication protection intent item. - :param intent_object_name: A name for the replication protection item. + :param intent_object_name: A name for the replication protection item. Required. :type intent_object_name: str - :param input: Create Protection Intent Input. + :param input: Create Protection Intent Input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput + :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: ReplicationProtectionIntent, or the result of cls(response) + :return: ReplicationProtectionIntent or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, intent_object_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param intent_object_name: A name for the replication protection item. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Required. + :type input: 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: ReplicationProtectionIntent or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, intent_object_name: str, input: Union[_models.CreateProtectionIntentInput, IO], **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param intent_object_name: A name for the replication protection item. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput 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: ReplicationProtectionIntent or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectionIntent"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'intentObjectName': self._serialize.url("intent_object_name", intent_object_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CreateProtectionIntentInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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.ReplicationProtectionIntent] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "CreateProtectionIntentInput") + + request = build_create_request( + intent_object_name=intent_object_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.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('ReplicationProtectionIntent', pipeline_response) + deserialized = self._deserialize("ReplicationProtectionIntent", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}'} # type: ignore + + create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_plans_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_plans_operations.py index 5c56917dca7a..ec948a4e1fa6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_plans_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_plans_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,92 +6,129 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_recovery_plans_operations import ( + build_create_request, + build_delete_request, + build_failover_cancel_request, + build_failover_commit_request, + build_get_request, + build_list_request, + build_planned_failover_request, + build_reprotect_request, + build_test_failover_cleanup_request, + build_test_failover_request, + build_unplanned_failover_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationRecoveryPlansOperations: - """ReplicationRecoveryPlansOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationRecoveryPlansOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_recovery_plans` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.RecoveryPlanCollection"]: + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.RecoveryPlan"]: """Gets the list of recovery plans. Lists the recovery plans in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPlanCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RecoveryPlan or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlanCollection"] + _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.RecoveryPlanCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RecoveryPlanCollection', pipeline_response) + deserialized = self._deserialize("RecoveryPlanCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,7 +137,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -108,108 +148,115 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - recovery_plan_name: str, - **kwargs: Any - ) -> "_models.RecoveryPlan": + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans"} # type: ignore + + @distributed_trace_async + async def get(self, recovery_plan_name: str, **kwargs: Any) -> _models.RecoveryPlan: """Gets the requested recovery plan. Gets the details of the recovery plan. - :param recovery_plan_name: Name of the recovery plan. + :param recovery_plan_name: Name of the recovery plan. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryPlan, or the result of cls(response) + :return: RecoveryPlan or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.RecoveryPlan] + + request = build_get_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore async def _create_initial( - self, - recovery_plan_name: str, - input: "_models.CreateRecoveryPlanInput", - **kwargs: Any - ) -> Optional["_models.RecoveryPlan"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.CreateRecoveryPlanInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CreateRecoveryPlanInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "CreateRecoveryPlanInput") + + request = build_create_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -218,115 +265,188 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore + + @overload async def begin_create( self, recovery_plan_name: str, - input: "_models.CreateRecoveryPlanInput", + input: _models.CreateRecoveryPlanInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryPlan"]: + ) -> AsyncLROPoller[_models.RecoveryPlan]: """Creates a recovery plan with the given details. The operation to create a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Recovery Plan creation input. + :param input: Recovery Plan creation input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, recovery_plan_name: str, input: Union[_models.CreateRecoveryPlanInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( - self, - recovery_plan_name: str, - **kwargs: Any + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, recovery_plan_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -336,110 +456,114 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore - async def begin_delete( - self, - recovery_plan_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + @distributed_trace_async + async def begin_delete(self, recovery_plan_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes the specified recovery plan. Delete a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore recovery_plan_name=recovery_plan_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore async def _update_initial( - self, - recovery_plan_name: str, - input: "_models.UpdateRecoveryPlanInput", - **kwargs: Any - ) -> Optional["_models.RecoveryPlan"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.UpdateRecoveryPlanInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'UpdateRecoveryPlanInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "UpdateRecoveryPlanInput") + + request = build_update_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -448,117 +572,186 @@ async def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore + + @overload async def begin_update( self, recovery_plan_name: str, - input: "_models.UpdateRecoveryPlanInput", + input: _models.UpdateRecoveryPlanInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryPlan"]: + ) -> AsyncLROPoller[_models.RecoveryPlan]: """Updates the given recovery plan. The operation to update a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Update recovery plan input. + :param input: Update recovery plan input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_update( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, recovery_plan_name: str, input: Union[_models.UpdateRecoveryPlanInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _failover_cancel_initial( - self, - recovery_plan_name: str, - **kwargs: Any - ) -> Optional["_models.RecoveryPlan"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore + + async def _failover_cancel_initial(self, recovery_plan_name: str, **kwargs: Any) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._failover_cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.RecoveryPlan]] + + request = build_failover_cancel_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._failover_cancel_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -567,113 +760,113 @@ async def _failover_cancel_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _failover_cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel'} # type: ignore + _failover_cancel_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel"} # type: ignore + + @distributed_trace_async async def begin_failover_cancel( - self, - recovery_plan_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryPlan"]: + self, recovery_plan_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: """Execute cancel failover of the recovery plan. The operation to cancel the failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._failover_cancel_initial( + raw_result = await self._failover_cancel_initial( # type: ignore recovery_plan_name=recovery_plan_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_failover_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _failover_commit_initial( - self, - recovery_plan_name: str, - **kwargs: Any - ) -> Optional["_models.RecoveryPlan"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + begin_failover_cancel.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel"} # type: ignore + + async def _failover_commit_initial(self, recovery_plan_name: str, **kwargs: Any) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._failover_commit_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.RecoveryPlan]] + + request = build_failover_commit_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._failover_commit_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -682,119 +875,127 @@ async def _failover_commit_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _failover_commit_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit'} # type: ignore + _failover_commit_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit"} # type: ignore + + @distributed_trace_async async def begin_failover_commit( - self, - recovery_plan_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryPlan"]: + self, recovery_plan_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: """Execute commit failover of the recovery plan. The operation to commit the failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._failover_commit_initial( + raw_result = await self._failover_commit_initial( # type: ignore recovery_plan_name=recovery_plan_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_failover_commit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_failover_commit.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit"} # type: ignore async def _planned_failover_initial( - self, - recovery_plan_name: str, - input: "_models.RecoveryPlanPlannedFailoverInput", - **kwargs: Any - ) -> Optional["_models.RecoveryPlan"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanPlannedFailoverInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._planned_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'RecoveryPlanPlannedFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "RecoveryPlanPlannedFailoverInput") + + request = build_planned_failover_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._planned_failover_initial.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, 202]: @@ -803,117 +1004,187 @@ async def _planned_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _planned_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover'} # type: ignore + _planned_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover"} # type: ignore + + @overload async def begin_planned_failover( self, recovery_plan_name: str, - input: "_models.RecoveryPlanPlannedFailoverInput", + input: _models.RecoveryPlanPlannedFailoverInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryPlan"]: + ) -> AsyncLROPoller[_models.RecoveryPlan]: """Execute planned failover of the recovery plan. The operation to start the planned failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Failover input. + :param input: Failover input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_planned_failover( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Failover input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_planned_failover( + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanPlannedFailoverInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Failover input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._planned_failover_initial( + raw_result = await self._planned_failover_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_planned_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _reprotect_initial( - self, - recovery_plan_name: str, - **kwargs: Any - ) -> Optional["_models.RecoveryPlan"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + begin_planned_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover"} # type: ignore + + async def _reprotect_initial(self, recovery_plan_name: str, **kwargs: Any) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._reprotect_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.RecoveryPlan]] + + request = build_reprotect_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reprotect_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -922,119 +1193,125 @@ async def _reprotect_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _reprotect_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect'} # type: ignore - async def begin_reprotect( - self, - recovery_plan_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryPlan"]: + _reprotect_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect"} # type: ignore + + @distributed_trace_async + async def begin_reprotect(self, recovery_plan_name: str, **kwargs: Any) -> AsyncLROPoller[_models.RecoveryPlan]: """Execute reprotect of the recovery plan. The operation to reprotect(reverse replicate) a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._reprotect_initial( + raw_result = await self._reprotect_initial( # type: ignore recovery_plan_name=recovery_plan_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reprotect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reprotect.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect"} # type: ignore async def _test_failover_initial( - self, - recovery_plan_name: str, - input: "_models.RecoveryPlanTestFailoverInput", - **kwargs: Any - ) -> Optional["_models.RecoveryPlan"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'RecoveryPlanTestFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "RecoveryPlanTestFailoverInput") + + request = build_test_failover_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_failover_initial.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, 202]: @@ -1043,123 +1320,201 @@ async def _test_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover'} # type: ignore + _test_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover"} # type: ignore + + @overload async def begin_test_failover( self, recovery_plan_name: str, - input: "_models.RecoveryPlanTestFailoverInput", + input: _models.RecoveryPlanTestFailoverInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryPlan"]: + ) -> AsyncLROPoller[_models.RecoveryPlan]: """Execute test failover of the recovery plan. The operation to start the test failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Recovery plan test failover input. + :param input: Recovery plan test failover input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_test_failover( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_failover( + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._test_failover_initial( + raw_result = await self._test_failover_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover"} # type: ignore async def _test_failover_cleanup_initial( - self, - recovery_plan_name: str, - input: "_models.RecoveryPlanTestFailoverCleanupInput", - **kwargs: Any - ) -> Optional["_models.RecoveryPlan"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverCleanupInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_failover_cleanup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'RecoveryPlanTestFailoverCleanupInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "RecoveryPlanTestFailoverCleanupInput") + + request = build_test_failover_cleanup_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_failover_cleanup_initial.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, 202]: @@ -1168,123 +1523,203 @@ async def _test_failover_cleanup_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_failover_cleanup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup'} # type: ignore + _test_failover_cleanup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup"} # type: ignore + + @overload async def begin_test_failover_cleanup( self, recovery_plan_name: str, - input: "_models.RecoveryPlanTestFailoverCleanupInput", + input: _models.RecoveryPlanTestFailoverCleanupInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryPlan"]: + ) -> AsyncLROPoller[_models.RecoveryPlan]: """Execute test failover cleanup of the recovery plan. The operation to cleanup test failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Recovery plan test failover cleanup input. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput + :param input: Recovery plan test failover cleanup input. Required. + :type input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_test_failover_cleanup( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_failover_cleanup( + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverCleanupInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Is either a model type or a IO type. + Required. + :type input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._test_failover_cleanup_initial( + raw_result = await self._test_failover_cleanup_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_failover_cleanup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_failover_cleanup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup"} # type: ignore async def _unplanned_failover_initial( - self, - recovery_plan_name: str, - input: "_models.RecoveryPlanUnplannedFailoverInput", - **kwargs: Any - ) -> Optional["_models.RecoveryPlan"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanUnplannedFailoverInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._unplanned_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'RecoveryPlanUnplannedFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "RecoveryPlanUnplannedFailoverInput") + + request = build_unplanned_failover_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._unplanned_failover_initial.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, 202]: @@ -1293,80 +1728,152 @@ async def _unplanned_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _unplanned_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover'} # type: ignore + _unplanned_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover"} # type: ignore + + @overload async def begin_unplanned_failover( self, recovery_plan_name: str, - input: "_models.RecoveryPlanUnplannedFailoverInput", + input: _models.RecoveryPlanUnplannedFailoverInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryPlan"]: + ) -> AsyncLROPoller[_models.RecoveryPlan]: """Execute unplanned failover of the recovery plan. The operation to start the unplanned failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Recovery plan unplanned failover input. + :param input: Recovery plan unplanned failover input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_unplanned_failover( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_unplanned_failover( + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanUnplannedFailoverInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Is either a model type or a IO type. + Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._unplanned_failover_initial( + raw_result = await self._unplanned_failover_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_unplanned_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_unplanned_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_services_providers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_services_providers_operations.py index 80f47eae7691..3467c0bb99d0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_services_providers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_services_providers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,96 +6,130 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_recovery_services_providers_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_replication_fabrics_request, + build_list_request, + build_purge_request, + build_refresh_provider_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationRecoveryServicesProvidersOperations: - """ReplicationRecoveryServicesProvidersOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationRecoveryServicesProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_recovery_services_providers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_fabrics( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.RecoveryServicesProviderCollection"]: + self, fabric_name: str, **kwargs: Any + ) -> AsyncIterable["_models.RecoveryServicesProvider"]: """Gets the list of registered recovery services providers for the fabric. Lists the registered recovery services providers for the specified fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryServicesProviderCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RecoveryServicesProvider or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProviderCollection"] + _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.RecoveryServicesProviderCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RecoveryServicesProviderCollection', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProviderCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,7 +138,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -112,114 +149,123 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - fabric_name: str, - provider_name: str, - **kwargs: Any - ) -> "_models.RecoveryServicesProvider": + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders"} # type: ignore + + @distributed_trace_async + async def get(self, fabric_name: str, provider_name: str, **kwargs: Any) -> _models.RecoveryServicesProvider: """Gets the details of a recovery services provider. Gets the details of registered recovery services provider. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryServicesProvider, or the result of cls(response) + :return: RecoveryServicesProvider or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProvider"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.RecoveryServicesProvider] + + request = build_get_request( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('RecoveryServicesProvider', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore async def _create_initial( self, fabric_name: str, provider_name: str, - add_provider_input: "_models.AddRecoveryServicesProviderInput", + add_provider_input: Union[_models.AddRecoveryServicesProviderInput, IO], **kwargs: Any - ) -> Optional["_models.RecoveryServicesProvider"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryServicesProvider"]] + ) -> Optional[_models.RecoveryServicesProvider]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(add_provider_input, 'AddRecoveryServicesProviderInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryServicesProvider]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(add_provider_input, (IO, bytes)): + _content = add_provider_input + else: + _json = self._serialize.body(add_provider_input, "AddRecoveryServicesProviderInput") + + request = build_create_request( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -228,122 +274,209 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore + + @overload async def begin_create( self, fabric_name: str, provider_name: str, - add_provider_input: "_models.AddRecoveryServicesProviderInput", + add_provider_input: _models.AddRecoveryServicesProviderInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryServicesProvider"]: + ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: """Adds a recovery services provider. The operation to add a recovery services provider. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str - :param add_provider_input: Add provider input. - :type add_provider_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput + :param add_provider_input: Add provider input. Required. + :type add_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryServicesProvider or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryServicesProvider or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProvider"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, + fabric_name: str, + provider_name: str, + add_provider_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Required. + :type add_provider_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryServicesProvider or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + fabric_name: str, + provider_name: str, + add_provider_input: Union[_models.AddRecoveryServicesProviderInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Is either a model type or a IO type. Required. + :type add_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryServicesProvider or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryServicesProvider] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore fabric_name=fabric_name, provider_name=provider_name, add_provider_input=add_provider_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) - + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _purge_initial( - self, - fabric_name: str, - provider_name: str, - **kwargs: Any + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore + + async def _purge_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, provider_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_purge_request( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -353,111 +486,106 @@ async def _purge_initial( if cls: return cls(pipeline_response, None, {}) - _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore - async def begin_purge( - self, - fabric_name: str, - provider_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + @distributed_trace_async + async def begin_purge(self, fabric_name: str, provider_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Purges recovery service provider from fabric. The operation to purge(force delete) a recovery services provider from the vault. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_initial( + raw_result = await self._purge_initial( # type: ignore fabric_name=fabric_name, provider_name=provider_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore async def _refresh_provider_initial( - self, - fabric_name: str, - provider_name: str, - **kwargs: Any - ) -> Optional["_models.RecoveryServicesProvider"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryServicesProvider"]] + self, fabric_name: str, provider_name: str, **kwargs: Any + ) -> Optional[_models.RecoveryServicesProvider]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._refresh_provider_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.RecoveryServicesProvider]] + + request = build_refresh_provider_request( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._refresh_provider_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -466,118 +594,119 @@ async def _refresh_provider_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _refresh_provider_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider'} # type: ignore + _refresh_provider_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider"} # type: ignore + + @distributed_trace_async async def begin_refresh_provider( - self, - fabric_name: str, - provider_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.RecoveryServicesProvider"]: + self, fabric_name: str, provider_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: """Refresh details from the recovery services provider. The operation to refresh the information from the recovery services provider. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RecoveryServicesProvider or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RecoveryServicesProvider or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProvider"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryServicesProvider] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._refresh_provider_initial( + raw_result = await self._refresh_provider_initial( # type: ignore fabric_name=fabric_name, provider_name=provider_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) - + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_refresh_provider.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( - self, - fabric_name: str, - provider_name: str, - **kwargs: Any + begin_refresh_provider.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, provider_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -587,124 +716,136 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove"} # type: ignore - async def begin_delete( - self, - fabric_name: str, - provider_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is unsupported. To maintain backward compatibility for released clients the object "deleteRspInput" is used (if the object is empty we assume that it is old client and continue the old behavior). + @distributed_trace_async + async def begin_delete(self, fabric_name: str, provider_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is + unsupported. To maintain backward compatibility for released clients the object + "deleteRspInput" is used (if the object is empty we assume that it is old client and continue + the old behavior). The operation to removes/delete(unregister) a recovery services provider from the vault. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore fabric_name=fabric_name, provider_name=provider_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.RecoveryServicesProviderCollection"]: + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.RecoveryServicesProvider"]: """Gets the list of registered recovery services providers in the vault. This is a view only api. Lists the registered recovery services providers in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryServicesProviderCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RecoveryServicesProvider or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProviderCollection"] + _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.RecoveryServicesProviderCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RecoveryServicesProviderCollection', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProviderCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -713,7 +854,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -722,7 +865,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classification_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classification_mappings_operations.py index f03d4631b17f..5bef218ca31c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classification_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classification_mappings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,131 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_storage_classification_mappings_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_replication_storage_classifications_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationStorageClassificationMappingsOperations: - """ReplicationStorageClassificationMappingsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationStorageClassificationMappingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_storage_classification_mappings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_storage_classifications( - self, - fabric_name: str, - storage_classification_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.StorageClassificationMappingCollection"]: + self, fabric_name: str, storage_classification_name: str, **kwargs: Any + ) -> AsyncIterable["_models.StorageClassificationMapping"]: """Gets the list of storage classification mappings objects under a storage. Lists the storage classification mappings for the fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageClassificationMappingCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageClassificationMapping or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationMappingCollection"] + _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.StorageClassificationMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_storage_classifications.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_storage_classifications_request( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_storage_classifications.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageClassificationMappingCollection', pipeline_response) + deserialized = self._deserialize("StorageClassificationMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,7 +139,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -116,120 +150,134 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_storage_classifications.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_storage_classifications.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings"} # type: ignore + @distributed_trace_async async def get( self, fabric_name: str, storage_classification_name: str, storage_classification_mapping_name: str, **kwargs: Any - ) -> "_models.StorageClassificationMapping": + ) -> _models.StorageClassificationMapping: """Gets the details of a storage classification mapping. Gets the details of the specified storage classification mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. + :param storage_classification_mapping_name: Storage classification mapping name. Required. :type storage_classification_mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageClassificationMapping, or the result of cls(response) + :return: StorageClassificationMapping or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationMapping"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.StorageClassificationMapping] + + request = build_get_request( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('StorageClassificationMapping', pipeline_response) + deserialized = self._deserialize("StorageClassificationMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore async def _create_initial( self, fabric_name: str, storage_classification_name: str, storage_classification_mapping_name: str, - pairing_input: "_models.StorageClassificationMappingInput", + pairing_input: Union[_models.StorageClassificationMappingInput, IO], **kwargs: Any - ) -> Optional["_models.StorageClassificationMapping"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageClassificationMapping"]] + ) -> Optional[_models.StorageClassificationMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pairing_input, 'StorageClassificationMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.StorageClassificationMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pairing_input, (IO, bytes)): + _content = pairing_input + else: + _json = self._serialize.body(pairing_input, "StorageClassificationMappingInput") + + request = build_create_request( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -238,129 +286,224 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StorageClassificationMapping', pipeline_response) + deserialized = self._deserialize("StorageClassificationMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore + + @overload async def begin_create( self, fabric_name: str, storage_classification_name: str, storage_classification_mapping_name: str, - pairing_input: "_models.StorageClassificationMappingInput", + pairing_input: _models.StorageClassificationMappingInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.StorageClassificationMapping"]: + ) -> AsyncLROPoller[_models.StorageClassificationMapping]: """Create storage classification mapping. The operation to create a storage classification mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. + :param storage_classification_mapping_name: Storage classification mapping name. Required. :type storage_classification_mapping_name: str - :param pairing_input: Pairing input. - :type pairing_input: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput + :param pairing_input: Pairing input. Required. + :type pairing_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageClassificationMapping or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageClassificationMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Required. + :type pairing_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageClassificationMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: Union[_models.StorageClassificationMappingInput, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Is either a model type or a IO type. Required. + :type pairing_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageClassificationMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.StorageClassificationMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore fabric_name=fabric_name, storage_classification_name=storage_classification_name, storage_classification_mapping_name=storage_classification_mapping_name, pairing_input=pairing_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('StorageClassificationMapping', pipeline_response) - + deserialized = self._deserialize("StorageClassificationMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, fabric_name: str, storage_classification_name: str, storage_classification_mapping_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -370,8 +513,9 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore + @distributed_trace_async async def begin_delete( self, fabric_name: str, @@ -383,116 +527,128 @@ async def begin_delete( The operation to delete a storage classification mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. + :param storage_classification_mapping_name: Storage classification mapping name. Required. :type storage_classification_mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore fabric_name=fabric_name, storage_classification_name=storage_classification_name, storage_classification_mapping_name=storage_classification_mapping_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.StorageClassificationMappingCollection"]: + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageClassificationMapping"]: """Gets the list of storage classification mappings objects under a vault. Lists the storage classification mappings in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageClassificationMappingCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageClassificationMapping or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationMappingCollection"] + _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.StorageClassificationMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageClassificationMappingCollection', pipeline_response) + deserialized = self._deserialize("StorageClassificationMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -501,7 +657,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -510,7 +668,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classifications_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classifications_operations.py index 268cea4ddaa0..231ff8f4002f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classifications_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classifications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,94 +6,124 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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 - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_storage_classifications_operations import ( + build_get_request, + build_list_by_replication_fabrics_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationStorageClassificationsOperations: - """ReplicationStorageClassificationsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationStorageClassificationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_storage_classifications` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_fabrics( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.StorageClassificationCollection"]: + self, fabric_name: str, **kwargs: Any + ) -> AsyncIterable["_models.StorageClassification"]: """Gets the list of storage classification objects under a fabric. Lists the storage classifications available in the specified fabric. - :param fabric_name: Site name of interest. + :param fabric_name: Site name of interest. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageClassificationCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageClassification or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationCollection"] + _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.StorageClassificationCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageClassificationCollection', pipeline_response) + deserialized = self._deserialize("StorageClassificationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,7 +132,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -110,121 +143,136 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications"} # type: ignore + @distributed_trace_async async def get( - self, - fabric_name: str, - storage_classification_name: str, - **kwargs: Any - ) -> "_models.StorageClassification": + self, fabric_name: str, storage_classification_name: str, **kwargs: Any + ) -> _models.StorageClassification: """Gets the details of a storage classification. Gets the details of the specified storage classification. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageClassification, or the result of cls(response) + :return: StorageClassification or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassification"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.StorageClassification] + + request = build_get_request( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('StorageClassification', pipeline_response) + deserialized = self._deserialize("StorageClassification", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}'} # type: ignore - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.StorageClassificationCollection"]: + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageClassification"]: """Gets the list of storage classification objects under a vault. Lists the storage classifications in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageClassificationCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageClassification or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationCollection"] + _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.StorageClassificationCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageClassificationCollection', pipeline_response) + deserialized = self._deserialize("StorageClassificationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -233,7 +281,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -242,7 +292,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_health_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_health_operations.py index 6a7bd7685f28..4001ac45c29e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_health_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_health_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,128 +6,139 @@ # 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, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._vendor import _convert_request +from ...operations._replication_vault_health_operations import build_get_request, build_refresh_request -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationVaultHealthOperations: - """ReplicationVaultHealthOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationVaultHealthOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_vault_health` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - async def get( - self, - **kwargs: Any - ) -> "_models.VaultHealthDetails": + @distributed_trace_async + async def get(self, **kwargs: Any) -> _models.VaultHealthDetails: """Gets the health summary for the vault. Gets the health details of the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultHealthDetails, or the result of cls(response) + :return: VaultHealthDetails or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultHealthDetails"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.VaultHealthDetails] + + request = build_get_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('VaultHealthDetails', pipeline_response) + deserialized = self._deserialize("VaultHealthDetails", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth'} # type: ignore - async def _refresh_initial( - self, - **kwargs: Any - ) -> Optional["_models.VaultHealthDetails"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VaultHealthDetails"]] + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth"} # type: ignore + + async def _refresh_initial(self, **kwargs: Any) -> Optional[_models.VaultHealthDetails]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.VaultHealthDetails]] + + request = build_refresh_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._refresh_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -135,71 +147,68 @@ async def _refresh_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VaultHealthDetails', pipeline_response) + deserialized = self._deserialize("VaultHealthDetails", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh'} # type: ignore - async def begin_refresh( - self, - **kwargs: Any - ) -> AsyncLROPoller["_models.VaultHealthDetails"]: + _refresh_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh"} # type: ignore + + @distributed_trace_async + async def begin_refresh(self, **kwargs: Any) -> AsyncLROPoller[_models.VaultHealthDetails]: """Refreshes health summary of the vault. Refreshes health summary of the vault. :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VaultHealthDetails or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VaultHealthDetails or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultHealthDetails"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.VaultHealthDetails] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._refresh_initial( - cls=lambda x,y,z: x, - **kwargs + raw_result = await self._refresh_initial( # type: ignore + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('VaultHealthDetails', pipeline_response) - + deserialized = self._deserialize("VaultHealthDetails", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_refresh.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_setting_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_setting_operations.py index 749dbb361a90..624d05889409 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_setting_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_setting_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,92 +6,120 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replication_vault_setting_operations import ( + build_create_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationVaultSettingOperations: - """ReplicationVaultSettingOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationVaultSettingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_vault_setting` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.VaultSettingCollection"]: + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.VaultSetting"]: """Gets the list of vault setting. Gets the list of vault setting. This includes the Migration Hub connection settings. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VaultSettingCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either VaultSetting or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultSettingCollection"] + _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.VaultSettingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultSettingCollection', pipeline_response) + deserialized = self._deserialize("VaultSettingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,7 +128,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -108,188 +139,268 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - vault_setting_name: str, - **kwargs: Any - ) -> "_models.VaultSetting": + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings"} # type: ignore + + @distributed_trace_async + async def get(self, vault_setting_name: str, **kwargs: Any) -> _models.VaultSetting: """Gets the vault setting. Gets the vault setting. This includes the Migration Hub connection settings. - :param vault_setting_name: Vault setting name. + :param vault_setting_name: Vault setting name. Required. :type vault_setting_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultSetting, or the result of cls(response) + :return: VaultSetting or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultSetting"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultSettingName': self._serialize.url("vault_setting_name", vault_setting_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.VaultSetting] + + request = build_get_request( + vault_setting_name=vault_setting_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('VaultSetting', pipeline_response) + deserialized = self._deserialize("VaultSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}"} # type: ignore async def _create_initial( - self, - vault_setting_name: str, - input: "_models.VaultSettingCreationInput", - **kwargs: Any - ) -> "_models.VaultSetting": - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultSetting"] + self, vault_setting_name: str, input: Union[_models.VaultSettingCreationInput, IO], **kwargs: Any + ) -> _models.VaultSetting: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultSettingName': self._serialize.url("vault_setting_name", vault_setting_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'VaultSettingCreationInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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.VaultSetting] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "VaultSettingCreationInput") + + request = build_create_request( + vault_setting_name=vault_setting_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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('VaultSetting', pipeline_response) + deserialized = self._deserialize("VaultSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}"} # type: ignore + + @overload async def begin_create( self, vault_setting_name: str, - input: "_models.VaultSettingCreationInput", + input: _models.VaultSettingCreationInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.VaultSetting"]: - """Updates vault setting. A vault setting object is a singleton per vault and it is always present by default. + ) -> AsyncLROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. The operation to configure vault setting. - :param vault_setting_name: Vault setting name. + :param vault_setting_name: Vault setting name. Required. :type vault_setting_name: str - :param input: Vault setting creation input. + :param input: Vault setting creation input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VaultSetting or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VaultSetting or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultSetting"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, vault_setting_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VaultSetting or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, vault_setting_name: str, input: Union[_models.VaultSettingCreationInput, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VaultSetting or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.VaultSetting] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore vault_setting_name=vault_setting_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('VaultSetting', pipeline_response) - + deserialized = self._deserialize("VaultSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultSettingName': self._serialize.url("vault_setting_name", vault_setting_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replicationv_centers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replicationv_centers_operations.py index 8f79f5778ca6..99ff414ba66c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replicationv_centers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replicationv_centers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,96 +6,126 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - -T = TypeVar('T') +from ..._vendor import _convert_request +from ...operations._replicationv_centers_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_replication_fabrics_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ReplicationvCentersOperations: - """ReplicationvCentersOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ReplicationvCentersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replicationv_centers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list_by_replication_fabrics( - self, - fabric_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.VCenterCollection"]: + @distributed_trace + def list_by_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> AsyncIterable["_models.VCenter"]: """Gets the list of vCenter registered under a fabric. Lists the vCenter servers registered in a fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VCenterCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenterCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either VCenter or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenterCollection"] + _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.VCenterCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VCenterCollection', pipeline_response) + deserialized = self._deserialize("VCenterCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,7 +134,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -112,114 +145,123 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters'} # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def get( - self, - fabric_name: str, - vcenter_name: str, - **kwargs: Any - ) -> "_models.VCenter": + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters"} # type: ignore + + @distributed_trace_async + async def get(self, fabric_name: str, vcenter_name: str, **kwargs: Any) -> _models.VCenter: """Gets the details of a vCenter. Gets the details of a registered vCenter server(Add vCenter server). - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param vcenter_name: vcenter name. + :param vcenter_name: vcenter name. Required. :type vcenter_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VCenter, or the result of cls(response) + :return: VCenter or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VCenter - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenter"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.VCenter] + + request = build_get_request( + fabric_name=fabric_name, + vcenter_name=vcenter_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('VCenter', pipeline_response) + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore async def _create_initial( self, fabric_name: str, vcenter_name: str, - add_v_center_request: "_models.AddVCenterRequest", + add_v_center_request: Union[_models.AddVCenterRequest, IO], **kwargs: Any - ) -> Optional["_models.VCenter"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VCenter"]] + ) -> Optional[_models.VCenter]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(add_v_center_request, 'AddVCenterRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.VCenter]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(add_v_center_request, (IO, bytes)): + _content = add_v_center_request + else: + _json = self._serialize.body(add_v_center_request, "AddVCenterRequest") + + request = build_create_request( + fabric_name=fabric_name, + vcenter_name=vcenter_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -228,122 +270,209 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VCenter', pipeline_response) + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore + + @overload async def begin_create( self, fabric_name: str, vcenter_name: str, - add_v_center_request: "_models.AddVCenterRequest", + add_v_center_request: _models.AddVCenterRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.VCenter"]: + ) -> AsyncLROPoller[_models.VCenter]: """Add vCenter. The operation to create a vCenter object.. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param vcenter_name: vcenter name. + :param vcenter_name: vcenter name. Required. :type vcenter_name: str - :param add_v_center_request: The input to the add vCenter operation. + :param add_v_center_request: The input to the add vCenter operation. Required. :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VCenter or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VCenter or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenter"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, + fabric_name: str, + vcenter_name: str, + add_v_center_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Required. + :type add_v_center_request: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VCenter or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + fabric_name: str, + vcenter_name: str, + add_v_center_request: Union[_models.AddVCenterRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Is either a model type or + a IO type. Required. + :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VCenter or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.VCenter] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore fabric_name=fabric_name, vcenter_name=vcenter_name, add_v_center_request=add_v_center_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('VCenter', pipeline_response) - + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( - self, - fabric_name: str, - vcenter_name: str, - **kwargs: Any + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, vcenter_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + vcenter_name=vcenter_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -353,117 +482,122 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore - async def begin_delete( - self, - fabric_name: str, - vcenter_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + @distributed_trace_async + async def begin_delete(self, fabric_name: str, vcenter_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Remove vcenter operation. The operation to remove(unregister) a registered vCenter server from the vault. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param vcenter_name: vcenter name. + :param vcenter_name: vcenter name. Required. :type vcenter_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore fabric_name=fabric_name, vcenter_name=vcenter_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore async def _update_initial( self, fabric_name: str, vcenter_name: str, - update_v_center_request: "_models.UpdateVCenterRequest", + update_v_center_request: Union[_models.UpdateVCenterRequest, IO], **kwargs: Any - ) -> Optional["_models.VCenter"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VCenter"]] + ) -> Optional[_models.VCenter]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_v_center_request, 'UpdateVCenterRequest') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.VCenter]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_v_center_request, (IO, bytes)): + _content = update_v_center_request + else: + _json = self._serialize.body(update_v_center_request, "UpdateVCenterRequest") + + request = build_update_request( + fabric_name=fabric_name, + vcenter_name=vcenter_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -472,137 +606,236 @@ async def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VCenter', pipeline_response) + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore + + @overload async def begin_update( self, fabric_name: str, vcenter_name: str, - update_v_center_request: "_models.UpdateVCenterRequest", + update_v_center_request: _models.UpdateVCenterRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.VCenter"]: + ) -> AsyncLROPoller[_models.VCenter]: """Update vCenter operation. The operation to update a registered vCenter. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param vcenter_name: vcenter name. + :param vcenter_name: vcenter name. Required. :type vcenter_name: str - :param update_v_center_request: The input to the update vCenter operation. - :type update_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VCenter or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VCenter or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenter"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_update( + self, + fabric_name: str, + vcenter_name: str, + update_v_center_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VCenter or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + fabric_name: str, + vcenter_name: str, + update_v_center_request: Union[_models.UpdateVCenterRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Is either a model + type or a IO type. Required. + :type update_v_center_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VCenter or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.VCenter] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore fabric_name=fabric_name, vcenter_name=vcenter_name, update_v_center_request=update_v_center_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('VCenter', pipeline_response) - + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.VCenterCollection"]: + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.VCenter"]: """Gets the list of vCenter registered under the vault. Lists the vCenter servers registered in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VCenterCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenterCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either VCenter or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenterCollection"] + _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.VCenterCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VCenterCollection', pipeline_response) + deserialized = self._deserialize("VCenterCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -611,7 +844,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -620,7 +855,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_supported_operating_systems_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_supported_operating_systems_operations.py index f0297f15e1a0..1816c0bd3f09 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_supported_operating_systems_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_supported_operating_systems_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,96 +6,105 @@ # 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, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Optional, TypeVar + +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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +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._supported_operating_systems_operations import build_get_request -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SupportedOperatingSystemsOperations: - """SupportedOperatingSystemsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SupportedOperatingSystemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`supported_operating_systems` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get( - self, - instance_type: Optional[str] = None, - **kwargs: Any - ) -> "_models.SupportedOperatingSystems": + 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_async + async def get(self, instance_type: Optional[str] = None, **kwargs: Any) -> _models.SupportedOperatingSystems: """Gets the data of supported operating systems by SRS. Gets the data of supported operating systems by SRS. - :param instance_type: The instance type. + :param instance_type: The instance type. Default value is None. :type instance_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedOperatingSystems, or the result of cls(response) + :return: SupportedOperatingSystems or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOperatingSystems - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedOperatingSystems"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if instance_type is not None: - query_parameters['instanceType'] = self._serialize.query("instance_type", instance_type, 'str') + 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.SupportedOperatingSystems] + + request = build_get_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + instance_type=instance_type, + 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 + ) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(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('SupportedOperatingSystems', pipeline_response) + deserialized = self._deserialize("SupportedOperatingSystems", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_target_compute_sizes_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_target_compute_sizes_operations.py index 19c76da87e88..b0c10ba5d8c8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_target_compute_sizes_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_target_compute_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,102 +6,124 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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, HttpRequest +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._target_compute_sizes_operations import build_list_by_replication_protected_items_request -T = TypeVar('T') +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class TargetComputeSizesOperations: - """TargetComputeSizesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class TargetComputeSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`target_compute_sizes` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protected_items( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.TargetComputeSizeCollection"]: + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> AsyncIterable["_models.TargetComputeSize"]: """Gets the list of target compute sizes for the replication protected item. Lists the available target compute sizes for a replication protected item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: protection container name. + :param protection_container_name: protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TargetComputeSizeCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either TargetComputeSize or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TargetComputeSizeCollection"] + _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.TargetComputeSizeCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protected_items.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protected_items_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_protected_items.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TargetComputeSizeCollection', pipeline_response) + deserialized = self._deserialize("TargetComputeSizeCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,7 +132,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -118,7 +143,6 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( - get_next, extract_data - ) - list_by_replication_protected_items.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes'} # type: ignore + return AsyncItemPaged(get_next, extract_data) + + list_by_replication_protected_items.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py index 239805a44784..a393308131b3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py @@ -6,1573 +6,1134 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import A2AAddDisksInput - from ._models_py3 import A2AApplyRecoveryPointInput - from ._models_py3 import A2AContainerCreationInput - from ._models_py3 import A2AContainerMappingInput - from ._models_py3 import A2ACreateProtectionIntentInput - from ._models_py3 import A2ACrossClusterMigrationApplyRecoveryPointInput - from ._models_py3 import A2ACrossClusterMigrationContainerCreationInput - from ._models_py3 import A2ACrossClusterMigrationEnableProtectionInput - from ._models_py3 import A2ACrossClusterMigrationPolicyCreationInput - from ._models_py3 import A2ACrossClusterMigrationReplicationDetails - from ._models_py3 import A2AEnableProtectionInput - from ._models_py3 import A2AEventDetails - from ._models_py3 import A2APolicyCreationInput - from ._models_py3 import A2APolicyDetails - from ._models_py3 import A2AProtectedDiskDetails - from ._models_py3 import A2AProtectedManagedDiskDetails - from ._models_py3 import A2AProtectionContainerMappingDetails - from ._models_py3 import A2AProtectionIntentDiskInputDetails - from ._models_py3 import A2AProtectionIntentManagedDiskInputDetails - from ._models_py3 import A2ARecoveryPointDetails - from ._models_py3 import A2ARemoveDisksInput - from ._models_py3 import A2AReplicationDetails - from ._models_py3 import A2AReplicationIntentDetails - from ._models_py3 import A2AReprotectInput - from ._models_py3 import A2ASwitchProtectionInput - from ._models_py3 import A2ATestFailoverInput - from ._models_py3 import A2AUnplannedFailoverInput - from ._models_py3 import A2AUnprotectedDiskDetails - from ._models_py3 import A2AUpdateContainerMappingInput - from ._models_py3 import A2AUpdateReplicationProtectedItemInput - from ._models_py3 import A2AVmDiskInputDetails - from ._models_py3 import A2AVmManagedDiskInputDetails - from ._models_py3 import A2AVmManagedDiskUpdateDetails - from ._models_py3 import A2AZoneDetails - from ._models_py3 import ASRTask - from ._models_py3 import AddDisksInput - from ._models_py3 import AddDisksInputProperties - from ._models_py3 import AddDisksProviderSpecificInput - from ._models_py3 import AddRecoveryServicesProviderInput - from ._models_py3 import AddRecoveryServicesProviderInputProperties - from ._models_py3 import AddVCenterRequest - from ._models_py3 import AddVCenterRequestProperties - from ._models_py3 import AgentDetails - from ._models_py3 import AgentDiskDetails - from ._models_py3 import Alert - from ._models_py3 import AlertCollection - from ._models_py3 import AlertProperties - from ._models_py3 import ApplyRecoveryPointInput - from ._models_py3 import ApplyRecoveryPointInputProperties - from ._models_py3 import ApplyRecoveryPointProviderSpecificInput - from ._models_py3 import AsrJobDetails - from ._models_py3 import AutomationRunbookTaskDetails - from ._models_py3 import AzureFabricCreationInput - from ._models_py3 import AzureFabricSpecificDetails - from ._models_py3 import AzureToAzureCreateNetworkMappingInput - from ._models_py3 import AzureToAzureNetworkMappingSettings - from ._models_py3 import AzureToAzureUpdateNetworkMappingInput - from ._models_py3 import AzureToAzureVmSyncedConfigDetails - from ._models_py3 import AzureVmDiskDetails - from ._models_py3 import ComputeSizeErrorDetails - from ._models_py3 import ConfigurationSettings - from ._models_py3 import ConfigureAlertRequest - from ._models_py3 import ConfigureAlertRequestProperties - from ._models_py3 import ConsistencyCheckTaskDetails - from ._models_py3 import CreateNetworkMappingInput - from ._models_py3 import CreateNetworkMappingInputProperties - from ._models_py3 import CreatePolicyInput - from ._models_py3 import CreatePolicyInputProperties - from ._models_py3 import CreateProtectionContainerInput - from ._models_py3 import CreateProtectionContainerInputProperties - from ._models_py3 import CreateProtectionContainerMappingInput - from ._models_py3 import CreateProtectionContainerMappingInputProperties - from ._models_py3 import CreateProtectionIntentInput - from ._models_py3 import CreateProtectionIntentProperties - from ._models_py3 import CreateProtectionIntentProviderSpecificDetails - from ._models_py3 import CreateRecoveryPlanInput - from ._models_py3 import CreateRecoveryPlanInputProperties - from ._models_py3 import CurrentJobDetails - from ._models_py3 import CurrentScenarioDetails - from ._models_py3 import DataStore - from ._models_py3 import DisableProtectionInput - from ._models_py3 import DisableProtectionInputProperties - from ._models_py3 import DisableProtectionProviderSpecificInput - from ._models_py3 import DiscoverProtectableItemRequest - from ._models_py3 import DiscoverProtectableItemRequestProperties - from ._models_py3 import DiskDetails - from ._models_py3 import DiskEncryptionInfo - from ._models_py3 import DiskEncryptionKeyInfo - from ._models_py3 import DiskVolumeDetails - from ._models_py3 import Display - from ._models_py3 import DraDetails - from ._models_py3 import EnableMigrationInput - from ._models_py3 import EnableMigrationInputProperties - from ._models_py3 import EnableMigrationProviderSpecificInput - from ._models_py3 import EnableProtectionInput - from ._models_py3 import EnableProtectionInputProperties - from ._models_py3 import EnableProtectionProviderSpecificInput - from ._models_py3 import EncryptionDetails - from ._models_py3 import Event - from ._models_py3 import EventCollection - from ._models_py3 import EventProperties - from ._models_py3 import EventProviderSpecificDetails - from ._models_py3 import EventQueryParameter - from ._models_py3 import EventSpecificDetails - from ._models_py3 import ExistingProtectionProfile - from ._models_py3 import ExistingRecoveryAvailabilitySet - from ._models_py3 import ExistingRecoveryProximityPlacementGroup - from ._models_py3 import ExistingRecoveryResourceGroup - from ._models_py3 import ExistingRecoveryVirtualNetwork - from ._models_py3 import ExistingStorageAccount - from ._models_py3 import ExportJobDetails - from ._models_py3 import Fabric - from ._models_py3 import FabricCollection - from ._models_py3 import FabricCreationInput - from ._models_py3 import FabricCreationInputProperties - from ._models_py3 import FabricProperties - from ._models_py3 import FabricQueryParameter - from ._models_py3 import FabricReplicationGroupTaskDetails - from ._models_py3 import FabricSpecificCreateNetworkMappingInput - from ._models_py3 import FabricSpecificCreationInput - from ._models_py3 import FabricSpecificDetails - from ._models_py3 import FabricSpecificUpdateNetworkMappingInput - from ._models_py3 import FailoverJobDetails - from ._models_py3 import FailoverProcessServerRequest - from ._models_py3 import FailoverProcessServerRequestProperties - from ._models_py3 import FailoverReplicationProtectedItemDetails - from ._models_py3 import GroupTaskDetails - from ._models_py3 import HealthError - from ._models_py3 import HealthErrorSummary - from ._models_py3 import HyperVHostDetails - from ._models_py3 import HyperVReplica2012EventDetails - from ._models_py3 import HyperVReplica2012R2EventDetails - from ._models_py3 import HyperVReplicaAzureApplyRecoveryPointInput - from ._models_py3 import HyperVReplicaAzureDiskInputDetails - from ._models_py3 import HyperVReplicaAzureEnableProtectionInput - from ._models_py3 import HyperVReplicaAzureEventDetails - from ._models_py3 import HyperVReplicaAzureFailbackProviderInput - from ._models_py3 import HyperVReplicaAzureManagedDiskDetails - from ._models_py3 import HyperVReplicaAzurePlannedFailoverProviderInput - from ._models_py3 import HyperVReplicaAzurePolicyDetails - from ._models_py3 import HyperVReplicaAzurePolicyInput - from ._models_py3 import HyperVReplicaAzureReplicationDetails - from ._models_py3 import HyperVReplicaAzureReprotectInput - from ._models_py3 import HyperVReplicaAzureTestFailoverInput - from ._models_py3 import HyperVReplicaAzureUnplannedFailoverInput - from ._models_py3 import HyperVReplicaAzureUpdateReplicationProtectedItemInput - from ._models_py3 import HyperVReplicaBaseEventDetails - from ._models_py3 import HyperVReplicaBasePolicyDetails - from ._models_py3 import HyperVReplicaBaseReplicationDetails - from ._models_py3 import HyperVReplicaBluePolicyDetails - from ._models_py3 import HyperVReplicaBluePolicyInput - from ._models_py3 import HyperVReplicaBlueReplicationDetails - from ._models_py3 import HyperVReplicaPolicyDetails - from ._models_py3 import HyperVReplicaPolicyInput - from ._models_py3 import HyperVReplicaReplicationDetails - from ._models_py3 import HyperVSiteDetails - from ._models_py3 import HyperVVirtualMachineDetails - from ._models_py3 import IPConfigDetails - from ._models_py3 import IPConfigInputDetails - from ._models_py3 import IdentityProviderDetails - from ._models_py3 import IdentityProviderInput - from ._models_py3 import InMageAgentDetails - from ._models_py3 import InMageAzureV2ApplyRecoveryPointInput - from ._models_py3 import InMageAzureV2DiskInputDetails - from ._models_py3 import InMageAzureV2EnableProtectionInput - from ._models_py3 import InMageAzureV2EventDetails - from ._models_py3 import InMageAzureV2ManagedDiskDetails - from ._models_py3 import InMageAzureV2PolicyDetails - from ._models_py3 import InMageAzureV2PolicyInput - from ._models_py3 import InMageAzureV2ProtectedDiskDetails - from ._models_py3 import InMageAzureV2RecoveryPointDetails - from ._models_py3 import InMageAzureV2ReplicationDetails - from ._models_py3 import InMageAzureV2ReprotectInput - from ._models_py3 import InMageAzureV2TestFailoverInput - from ._models_py3 import InMageAzureV2UnplannedFailoverInput - from ._models_py3 import InMageAzureV2UpdateReplicationProtectedItemInput - from ._models_py3 import InMageBasePolicyDetails - from ._models_py3 import InMageDisableProtectionProviderSpecificInput - from ._models_py3 import InMageDiskDetails - from ._models_py3 import InMageDiskExclusionInput - from ._models_py3 import InMageDiskSignatureExclusionOptions - from ._models_py3 import InMageEnableProtectionInput - from ._models_py3 import InMagePolicyDetails - from ._models_py3 import InMagePolicyInput - from ._models_py3 import InMageProtectedDiskDetails - from ._models_py3 import InMageRcmAgentUpgradeBlockingErrorDetails - from ._models_py3 import InMageRcmApplyRecoveryPointInput - from ._models_py3 import InMageRcmDiscoveredProtectedVmDetails - from ._models_py3 import InMageRcmDiskInput - from ._models_py3 import InMageRcmDisksDefaultInput - from ._models_py3 import InMageRcmEnableProtectionInput - from ._models_py3 import InMageRcmEventDetails - from ._models_py3 import InMageRcmFabricCreationInput - from ._models_py3 import InMageRcmFabricSpecificDetails - from ._models_py3 import InMageRcmFailbackDiscoveredProtectedVmDetails - from ._models_py3 import InMageRcmFailbackEventDetails - from ._models_py3 import InMageRcmFailbackMobilityAgentDetails - from ._models_py3 import InMageRcmFailbackNicDetails - from ._models_py3 import InMageRcmFailbackPlannedFailoverProviderInput - from ._models_py3 import InMageRcmFailbackPolicyCreationInput - from ._models_py3 import InMageRcmFailbackPolicyDetails - from ._models_py3 import InMageRcmFailbackProtectedDiskDetails - from ._models_py3 import InMageRcmFailbackReplicationDetails - from ._models_py3 import InMageRcmFailbackReprotectInput - from ._models_py3 import InMageRcmFailbackSyncDetails - from ._models_py3 import InMageRcmLastAgentUpgradeErrorDetails - from ._models_py3 import InMageRcmMobilityAgentDetails - from ._models_py3 import InMageRcmNicDetails - from ._models_py3 import InMageRcmNicInput - from ._models_py3 import InMageRcmPolicyCreationInput - from ._models_py3 import InMageRcmPolicyDetails - from ._models_py3 import InMageRcmProtectedDiskDetails - from ._models_py3 import InMageRcmProtectionContainerMappingDetails - from ._models_py3 import InMageRcmRecoveryPointDetails - from ._models_py3 import InMageRcmReplicationDetails - from ._models_py3 import InMageRcmReprotectInput - from ._models_py3 import InMageRcmSyncDetails - from ._models_py3 import InMageRcmTestFailoverInput - from ._models_py3 import InMageRcmUnplannedFailoverInput - from ._models_py3 import InMageRcmUpdateApplianceForReplicationProtectedItemInput - from ._models_py3 import InMageRcmUpdateContainerMappingInput - from ._models_py3 import InMageRcmUpdateReplicationProtectedItemInput - from ._models_py3 import InMageReplicationDetails - from ._models_py3 import InMageReprotectInput - from ._models_py3 import InMageTestFailoverInput - from ._models_py3 import InMageUnplannedFailoverInput - from ._models_py3 import InMageVolumeExclusionOptions - from ._models_py3 import InconsistentVmDetails - from ._models_py3 import InitialReplicationDetails - from ._models_py3 import InlineWorkflowTaskDetails - from ._models_py3 import InnerHealthError - from ._models_py3 import InputEndpoint - from ._models_py3 import Job - from ._models_py3 import JobCollection - from ._models_py3 import JobDetails - from ._models_py3 import JobEntity - from ._models_py3 import JobErrorDetails - from ._models_py3 import JobProperties - from ._models_py3 import JobQueryParameter - from ._models_py3 import JobStatusEventDetails - from ._models_py3 import JobTaskDetails - from ._models_py3 import KeyEncryptionKeyInfo - from ._models_py3 import LogicalNetwork - from ._models_py3 import LogicalNetworkCollection - from ._models_py3 import LogicalNetworkProperties - from ._models_py3 import ManualActionTaskDetails - from ._models_py3 import MarsAgentDetails - from ._models_py3 import MasterTargetServer - from ._models_py3 import MigrateInput - from ._models_py3 import MigrateInputProperties - from ._models_py3 import MigrateProviderSpecificInput - from ._models_py3 import MigrationItem - from ._models_py3 import MigrationItemCollection - from ._models_py3 import MigrationItemProperties - from ._models_py3 import MigrationItemsQueryParameter - from ._models_py3 import MigrationProviderSpecificSettings - from ._models_py3 import MigrationRecoveryPoint - from ._models_py3 import MigrationRecoveryPointCollection - from ._models_py3 import MigrationRecoveryPointProperties - from ._models_py3 import MobilityServiceUpdate - from ._models_py3 import Network - from ._models_py3 import NetworkCollection - from ._models_py3 import NetworkMapping - from ._models_py3 import NetworkMappingCollection - from ._models_py3 import NetworkMappingFabricSpecificSettings - from ._models_py3 import NetworkMappingProperties - from ._models_py3 import NetworkProperties - from ._models_py3 import NewProtectionProfile - from ._models_py3 import NewRecoveryVirtualNetwork - from ._models_py3 import OSDetails - from ._models_py3 import OSDiskDetails - from ._models_py3 import OSVersionWrapper - from ._models_py3 import OperationsDiscovery - from ._models_py3 import OperationsDiscoveryCollection - from ._models_py3 import PlannedFailoverInput - from ._models_py3 import PlannedFailoverInputProperties - from ._models_py3 import PlannedFailoverProviderSpecificFailoverInput - from ._models_py3 import Policy - from ._models_py3 import PolicyCollection - from ._models_py3 import PolicyProperties - from ._models_py3 import PolicyProviderSpecificDetails - from ._models_py3 import PolicyProviderSpecificInput - from ._models_py3 import ProcessServer - from ._models_py3 import ProcessServerDetails - from ._models_py3 import ProtectableItem - from ._models_py3 import ProtectableItemCollection - from ._models_py3 import ProtectableItemProperties - from ._models_py3 import ProtectableItemQueryParameter - from ._models_py3 import ProtectedItemsQueryParameter - from ._models_py3 import ProtectionContainer - from ._models_py3 import ProtectionContainerCollection - from ._models_py3 import ProtectionContainerFabricSpecificDetails - from ._models_py3 import ProtectionContainerMapping - from ._models_py3 import ProtectionContainerMappingCollection - from ._models_py3 import ProtectionContainerMappingProperties - from ._models_py3 import ProtectionContainerMappingProviderSpecificDetails - from ._models_py3 import ProtectionContainerProperties - from ._models_py3 import ProtectionProfileCustomDetails - from ._models_py3 import ProviderError - from ._models_py3 import ProviderSpecificRecoveryPointDetails - from ._models_py3 import PushInstallerDetails - from ._models_py3 import RcmProxyDetails - from ._models_py3 import RecoveryAvailabilitySetCustomDetails - from ._models_py3 import RecoveryPlan - from ._models_py3 import RecoveryPlanA2ADetails - from ._models_py3 import RecoveryPlanA2AFailoverInput - from ._models_py3 import RecoveryPlanA2AInput - from ._models_py3 import RecoveryPlanAction - from ._models_py3 import RecoveryPlanActionDetails - from ._models_py3 import RecoveryPlanAutomationRunbookActionDetails - from ._models_py3 import RecoveryPlanCollection - from ._models_py3 import RecoveryPlanGroup - from ._models_py3 import RecoveryPlanGroupTaskDetails - from ._models_py3 import RecoveryPlanHyperVReplicaAzureFailbackInput - from ._models_py3 import RecoveryPlanHyperVReplicaAzureFailoverInput - from ._models_py3 import RecoveryPlanInMageAzureV2FailoverInput - from ._models_py3 import RecoveryPlanInMageFailoverInput - from ._models_py3 import RecoveryPlanInMageRcmFailbackFailoverInput - from ._models_py3 import RecoveryPlanInMageRcmFailoverInput - from ._models_py3 import RecoveryPlanManualActionDetails - from ._models_py3 import RecoveryPlanPlannedFailoverInput - from ._models_py3 import RecoveryPlanPlannedFailoverInputProperties - from ._models_py3 import RecoveryPlanProperties - from ._models_py3 import RecoveryPlanProtectedItem - from ._models_py3 import RecoveryPlanProviderSpecificDetails - from ._models_py3 import RecoveryPlanProviderSpecificFailoverInput - from ._models_py3 import RecoveryPlanProviderSpecificInput - from ._models_py3 import RecoveryPlanScriptActionDetails - from ._models_py3 import RecoveryPlanShutdownGroupTaskDetails - from ._models_py3 import RecoveryPlanTestFailoverCleanupInput - from ._models_py3 import RecoveryPlanTestFailoverCleanupInputProperties - from ._models_py3 import RecoveryPlanTestFailoverInput - from ._models_py3 import RecoveryPlanTestFailoverInputProperties - from ._models_py3 import RecoveryPlanUnplannedFailoverInput - from ._models_py3 import RecoveryPlanUnplannedFailoverInputProperties - from ._models_py3 import RecoveryPoint - from ._models_py3 import RecoveryPointCollection - from ._models_py3 import RecoveryPointProperties - from ._models_py3 import RecoveryProximityPlacementGroupCustomDetails - from ._models_py3 import RecoveryResourceGroupCustomDetails - from ._models_py3 import RecoveryServicesProvider - from ._models_py3 import RecoveryServicesProviderCollection - from ._models_py3 import RecoveryServicesProviderProperties - from ._models_py3 import RecoveryVirtualNetworkCustomDetails - from ._models_py3 import RemoveDisksInput - from ._models_py3 import RemoveDisksInputProperties - from ._models_py3 import RemoveDisksProviderSpecificInput - from ._models_py3 import RemoveProtectionContainerMappingInput - from ._models_py3 import RemoveProtectionContainerMappingInputProperties - from ._models_py3 import RenewCertificateInput - from ._models_py3 import RenewCertificateInputProperties - from ._models_py3 import ReplicationAgentDetails - from ._models_py3 import ReplicationEligibilityResults - from ._models_py3 import ReplicationEligibilityResultsCollection - from ._models_py3 import ReplicationEligibilityResultsErrorInfo - from ._models_py3 import ReplicationEligibilityResultsProperties - from ._models_py3 import ReplicationGroupDetails - from ._models_py3 import ReplicationProtectedItem - from ._models_py3 import ReplicationProtectedItemCollection - from ._models_py3 import ReplicationProtectedItemProperties - from ._models_py3 import ReplicationProtectionIntent - from ._models_py3 import ReplicationProtectionIntentCollection - from ._models_py3 import ReplicationProtectionIntentProperties - from ._models_py3 import ReplicationProtectionIntentProviderSpecificSettings - from ._models_py3 import ReplicationProviderContainerUnmappingInput - from ._models_py3 import ReplicationProviderSpecificContainerCreationInput - from ._models_py3 import ReplicationProviderSpecificContainerMappingInput - from ._models_py3 import ReplicationProviderSpecificSettings - from ._models_py3 import ReplicationProviderSpecificUpdateContainerMappingInput - from ._models_py3 import ReprotectAgentDetails - from ._models_py3 import ResolveHealthError - from ._models_py3 import ResolveHealthInput - from ._models_py3 import ResolveHealthInputProperties - from ._models_py3 import Resource - from ._models_py3 import ResourceHealthSummary - from ._models_py3 import ResumeJobParams - from ._models_py3 import ResumeJobParamsProperties - from ._models_py3 import ResyncInput - from ._models_py3 import ResyncInputProperties - from ._models_py3 import ResyncProviderSpecificInput - from ._models_py3 import RetentionVolume - from ._models_py3 import ReverseReplicationInput - from ._models_py3 import ReverseReplicationInputProperties - from ._models_py3 import ReverseReplicationProviderSpecificInput - from ._models_py3 import RoleAssignment - from ._models_py3 import RunAsAccount - from ._models_py3 import ScriptActionTaskDetails - from ._models_py3 import ServiceError - from ._models_py3 import StorageAccountCustomDetails - from ._models_py3 import StorageClassification - from ._models_py3 import StorageClassificationCollection - from ._models_py3 import StorageClassificationMapping - from ._models_py3 import StorageClassificationMappingCollection - from ._models_py3 import StorageClassificationMappingInput - from ._models_py3 import StorageClassificationMappingProperties - from ._models_py3 import StorageClassificationProperties - from ._models_py3 import StorageMappingInputProperties - from ._models_py3 import Subnet - from ._models_py3 import SupportedOSDetails - from ._models_py3 import SupportedOSProperties - from ._models_py3 import SupportedOSProperty - from ._models_py3 import SupportedOperatingSystems - from ._models_py3 import SwitchProtectionInput - from ._models_py3 import SwitchProtectionInputProperties - from ._models_py3 import SwitchProtectionJobDetails - from ._models_py3 import SwitchProtectionProviderSpecificInput - from ._models_py3 import TargetComputeSize - from ._models_py3 import TargetComputeSizeCollection - from ._models_py3 import TargetComputeSizeProperties - from ._models_py3 import TaskTypeDetails - from ._models_py3 import TestFailoverCleanupInput - from ._models_py3 import TestFailoverCleanupInputProperties - from ._models_py3 import TestFailoverInput - from ._models_py3 import TestFailoverInputProperties - from ._models_py3 import TestFailoverJobDetails - from ._models_py3 import TestFailoverProviderSpecificInput - from ._models_py3 import TestMigrateCleanupInput - from ._models_py3 import TestMigrateCleanupInputProperties - from ._models_py3 import TestMigrateInput - from ._models_py3 import TestMigrateInputProperties - from ._models_py3 import TestMigrateProviderSpecificInput - from ._models_py3 import UnplannedFailoverInput - from ._models_py3 import UnplannedFailoverInputProperties - from ._models_py3 import UnplannedFailoverProviderSpecificInput - from ._models_py3 import UpdateApplianceForReplicationProtectedItemInput - from ._models_py3 import UpdateApplianceForReplicationProtectedItemInputProperties - from ._models_py3 import UpdateApplianceForReplicationProtectedItemProviderSpecificInput - from ._models_py3 import UpdateDiskInput - from ._models_py3 import UpdateMigrationItemInput - from ._models_py3 import UpdateMigrationItemInputProperties - from ._models_py3 import UpdateMigrationItemProviderSpecificInput - from ._models_py3 import UpdateMobilityServiceRequest - from ._models_py3 import UpdateMobilityServiceRequestProperties - from ._models_py3 import UpdateNetworkMappingInput - from ._models_py3 import UpdateNetworkMappingInputProperties - from ._models_py3 import UpdatePolicyInput - from ._models_py3 import UpdatePolicyInputProperties - from ._models_py3 import UpdateProtectionContainerMappingInput - from ._models_py3 import UpdateProtectionContainerMappingInputProperties - from ._models_py3 import UpdateRecoveryPlanInput - from ._models_py3 import UpdateRecoveryPlanInputProperties - from ._models_py3 import UpdateReplicationProtectedItemInput - from ._models_py3 import UpdateReplicationProtectedItemInputProperties - from ._models_py3 import UpdateReplicationProtectedItemProviderInput - from ._models_py3 import UpdateVCenterRequest - from ._models_py3 import UpdateVCenterRequestProperties - from ._models_py3 import VCenter - from ._models_py3 import VCenterCollection - from ._models_py3 import VCenterProperties - from ._models_py3 import VMNicDetails - from ._models_py3 import VMNicInputDetails - from ._models_py3 import VMwareCbtContainerCreationInput - from ._models_py3 import VMwareCbtContainerMappingInput - from ._models_py3 import VMwareCbtDiskInput - from ._models_py3 import VMwareCbtEnableMigrationInput - from ._models_py3 import VMwareCbtEventDetails - from ._models_py3 import VMwareCbtMigrateInput - from ._models_py3 import VMwareCbtMigrationDetails - from ._models_py3 import VMwareCbtNicDetails - from ._models_py3 import VMwareCbtNicInput - from ._models_py3 import VMwareCbtPolicyCreationInput - from ._models_py3 import VMwareCbtProtectedDiskDetails - from ._models_py3 import VMwareCbtProtectionContainerMappingDetails - from ._models_py3 import VMwareCbtResyncInput - from ._models_py3 import VMwareCbtTestMigrateInput - from ._models_py3 import VMwareCbtUpdateDiskInput - from ._models_py3 import VMwareCbtUpdateMigrationItemInput - from ._models_py3 import VMwareDetails - from ._models_py3 import VMwareV2FabricCreationInput - from ._models_py3 import VMwareV2FabricSpecificDetails - from ._models_py3 import VMwareVirtualMachineDetails - from ._models_py3 import VaultHealthDetails - from ._models_py3 import VaultHealthProperties - from ._models_py3 import VaultSetting - from ._models_py3 import VaultSettingCollection - from ._models_py3 import VaultSettingCreationInput - from ._models_py3 import VaultSettingCreationInputProperties - from ._models_py3 import VaultSettingProperties - from ._models_py3 import VersionDetails - from ._models_py3 import VirtualMachineTaskDetails - from ._models_py3 import VmNicUpdatesTaskDetails - from ._models_py3 import VmmDetails - from ._models_py3 import VmmToAzureCreateNetworkMappingInput - from ._models_py3 import VmmToAzureNetworkMappingSettings - from ._models_py3 import VmmToAzureUpdateNetworkMappingInput - from ._models_py3 import VmmToVmmCreateNetworkMappingInput - from ._models_py3 import VmmToVmmNetworkMappingSettings - from ._models_py3 import VmmToVmmUpdateNetworkMappingInput - from ._models_py3 import VmmVirtualMachineDetails - from ._models_py3 import VmwareCbtPolicyDetails -except (SyntaxError, ImportError): - from ._models import A2AAddDisksInput # type: ignore - from ._models import A2AApplyRecoveryPointInput # type: ignore - from ._models import A2AContainerCreationInput # type: ignore - from ._models import A2AContainerMappingInput # type: ignore - from ._models import A2ACreateProtectionIntentInput # type: ignore - from ._models import A2ACrossClusterMigrationApplyRecoveryPointInput # type: ignore - from ._models import A2ACrossClusterMigrationContainerCreationInput # type: ignore - from ._models import A2ACrossClusterMigrationEnableProtectionInput # type: ignore - from ._models import A2ACrossClusterMigrationPolicyCreationInput # type: ignore - from ._models import A2ACrossClusterMigrationReplicationDetails # type: ignore - from ._models import A2AEnableProtectionInput # type: ignore - from ._models import A2AEventDetails # type: ignore - from ._models import A2APolicyCreationInput # type: ignore - from ._models import A2APolicyDetails # type: ignore - from ._models import A2AProtectedDiskDetails # type: ignore - from ._models import A2AProtectedManagedDiskDetails # type: ignore - from ._models import A2AProtectionContainerMappingDetails # type: ignore - from ._models import A2AProtectionIntentDiskInputDetails # type: ignore - from ._models import A2AProtectionIntentManagedDiskInputDetails # type: ignore - from ._models import A2ARecoveryPointDetails # type: ignore - from ._models import A2ARemoveDisksInput # type: ignore - from ._models import A2AReplicationDetails # type: ignore - from ._models import A2AReplicationIntentDetails # type: ignore - from ._models import A2AReprotectInput # type: ignore - from ._models import A2ASwitchProtectionInput # type: ignore - from ._models import A2ATestFailoverInput # type: ignore - from ._models import A2AUnplannedFailoverInput # type: ignore - from ._models import A2AUnprotectedDiskDetails # type: ignore - from ._models import A2AUpdateContainerMappingInput # type: ignore - from ._models import A2AUpdateReplicationProtectedItemInput # type: ignore - from ._models import A2AVmDiskInputDetails # type: ignore - from ._models import A2AVmManagedDiskInputDetails # type: ignore - from ._models import A2AVmManagedDiskUpdateDetails # type: ignore - from ._models import A2AZoneDetails # type: ignore - from ._models import ASRTask # type: ignore - from ._models import AddDisksInput # type: ignore - from ._models import AddDisksInputProperties # type: ignore - from ._models import AddDisksProviderSpecificInput # type: ignore - from ._models import AddRecoveryServicesProviderInput # type: ignore - from ._models import AddRecoveryServicesProviderInputProperties # type: ignore - from ._models import AddVCenterRequest # type: ignore - from ._models import AddVCenterRequestProperties # type: ignore - from ._models import AgentDetails # type: ignore - from ._models import AgentDiskDetails # type: ignore - from ._models import Alert # type: ignore - from ._models import AlertCollection # type: ignore - from ._models import AlertProperties # type: ignore - from ._models import ApplyRecoveryPointInput # type: ignore - from ._models import ApplyRecoveryPointInputProperties # type: ignore - from ._models import ApplyRecoveryPointProviderSpecificInput # type: ignore - from ._models import AsrJobDetails # type: ignore - from ._models import AutomationRunbookTaskDetails # type: ignore - from ._models import AzureFabricCreationInput # type: ignore - from ._models import AzureFabricSpecificDetails # type: ignore - from ._models import AzureToAzureCreateNetworkMappingInput # type: ignore - from ._models import AzureToAzureNetworkMappingSettings # type: ignore - from ._models import AzureToAzureUpdateNetworkMappingInput # type: ignore - from ._models import AzureToAzureVmSyncedConfigDetails # type: ignore - from ._models import AzureVmDiskDetails # type: ignore - from ._models import ComputeSizeErrorDetails # type: ignore - from ._models import ConfigurationSettings # type: ignore - from ._models import ConfigureAlertRequest # type: ignore - from ._models import ConfigureAlertRequestProperties # type: ignore - from ._models import ConsistencyCheckTaskDetails # type: ignore - from ._models import CreateNetworkMappingInput # type: ignore - from ._models import CreateNetworkMappingInputProperties # type: ignore - from ._models import CreatePolicyInput # type: ignore - from ._models import CreatePolicyInputProperties # type: ignore - from ._models import CreateProtectionContainerInput # type: ignore - from ._models import CreateProtectionContainerInputProperties # type: ignore - from ._models import CreateProtectionContainerMappingInput # type: ignore - from ._models import CreateProtectionContainerMappingInputProperties # type: ignore - from ._models import CreateProtectionIntentInput # type: ignore - from ._models import CreateProtectionIntentProperties # type: ignore - from ._models import CreateProtectionIntentProviderSpecificDetails # type: ignore - from ._models import CreateRecoveryPlanInput # type: ignore - from ._models import CreateRecoveryPlanInputProperties # type: ignore - from ._models import CurrentJobDetails # type: ignore - from ._models import CurrentScenarioDetails # type: ignore - from ._models import DataStore # type: ignore - from ._models import DisableProtectionInput # type: ignore - from ._models import DisableProtectionInputProperties # type: ignore - from ._models import DisableProtectionProviderSpecificInput # type: ignore - from ._models import DiscoverProtectableItemRequest # type: ignore - from ._models import DiscoverProtectableItemRequestProperties # type: ignore - from ._models import DiskDetails # type: ignore - from ._models import DiskEncryptionInfo # type: ignore - from ._models import DiskEncryptionKeyInfo # type: ignore - from ._models import DiskVolumeDetails # type: ignore - from ._models import Display # type: ignore - from ._models import DraDetails # type: ignore - from ._models import EnableMigrationInput # type: ignore - from ._models import EnableMigrationInputProperties # type: ignore - from ._models import EnableMigrationProviderSpecificInput # type: ignore - from ._models import EnableProtectionInput # type: ignore - from ._models import EnableProtectionInputProperties # type: ignore - from ._models import EnableProtectionProviderSpecificInput # type: ignore - from ._models import EncryptionDetails # type: ignore - from ._models import Event # type: ignore - from ._models import EventCollection # type: ignore - from ._models import EventProperties # type: ignore - from ._models import EventProviderSpecificDetails # type: ignore - from ._models import EventQueryParameter # type: ignore - from ._models import EventSpecificDetails # type: ignore - from ._models import ExistingProtectionProfile # type: ignore - from ._models import ExistingRecoveryAvailabilitySet # type: ignore - from ._models import ExistingRecoveryProximityPlacementGroup # type: ignore - from ._models import ExistingRecoveryResourceGroup # type: ignore - from ._models import ExistingRecoveryVirtualNetwork # type: ignore - from ._models import ExistingStorageAccount # type: ignore - from ._models import ExportJobDetails # type: ignore - from ._models import Fabric # type: ignore - from ._models import FabricCollection # type: ignore - from ._models import FabricCreationInput # type: ignore - from ._models import FabricCreationInputProperties # type: ignore - from ._models import FabricProperties # type: ignore - from ._models import FabricQueryParameter # type: ignore - from ._models import FabricReplicationGroupTaskDetails # type: ignore - from ._models import FabricSpecificCreateNetworkMappingInput # type: ignore - from ._models import FabricSpecificCreationInput # type: ignore - from ._models import FabricSpecificDetails # type: ignore - from ._models import FabricSpecificUpdateNetworkMappingInput # type: ignore - from ._models import FailoverJobDetails # type: ignore - from ._models import FailoverProcessServerRequest # type: ignore - from ._models import FailoverProcessServerRequestProperties # type: ignore - from ._models import FailoverReplicationProtectedItemDetails # type: ignore - from ._models import GroupTaskDetails # type: ignore - from ._models import HealthError # type: ignore - from ._models import HealthErrorSummary # type: ignore - from ._models import HyperVHostDetails # type: ignore - from ._models import HyperVReplica2012EventDetails # type: ignore - from ._models import HyperVReplica2012R2EventDetails # type: ignore - from ._models import HyperVReplicaAzureApplyRecoveryPointInput # type: ignore - from ._models import HyperVReplicaAzureDiskInputDetails # type: ignore - from ._models import HyperVReplicaAzureEnableProtectionInput # type: ignore - from ._models import HyperVReplicaAzureEventDetails # type: ignore - from ._models import HyperVReplicaAzureFailbackProviderInput # type: ignore - from ._models import HyperVReplicaAzureManagedDiskDetails # type: ignore - from ._models import HyperVReplicaAzurePlannedFailoverProviderInput # type: ignore - from ._models import HyperVReplicaAzurePolicyDetails # type: ignore - from ._models import HyperVReplicaAzurePolicyInput # type: ignore - from ._models import HyperVReplicaAzureReplicationDetails # type: ignore - from ._models import HyperVReplicaAzureReprotectInput # type: ignore - from ._models import HyperVReplicaAzureTestFailoverInput # type: ignore - from ._models import HyperVReplicaAzureUnplannedFailoverInput # type: ignore - from ._models import HyperVReplicaAzureUpdateReplicationProtectedItemInput # type: ignore - from ._models import HyperVReplicaBaseEventDetails # type: ignore - from ._models import HyperVReplicaBasePolicyDetails # type: ignore - from ._models import HyperVReplicaBaseReplicationDetails # type: ignore - from ._models import HyperVReplicaBluePolicyDetails # type: ignore - from ._models import HyperVReplicaBluePolicyInput # type: ignore - from ._models import HyperVReplicaBlueReplicationDetails # type: ignore - from ._models import HyperVReplicaPolicyDetails # type: ignore - from ._models import HyperVReplicaPolicyInput # type: ignore - from ._models import HyperVReplicaReplicationDetails # type: ignore - from ._models import HyperVSiteDetails # type: ignore - from ._models import HyperVVirtualMachineDetails # type: ignore - from ._models import IPConfigDetails # type: ignore - from ._models import IPConfigInputDetails # type: ignore - from ._models import IdentityProviderDetails # type: ignore - from ._models import IdentityProviderInput # type: ignore - from ._models import InMageAgentDetails # type: ignore - from ._models import InMageAzureV2ApplyRecoveryPointInput # type: ignore - from ._models import InMageAzureV2DiskInputDetails # type: ignore - from ._models import InMageAzureV2EnableProtectionInput # type: ignore - from ._models import InMageAzureV2EventDetails # type: ignore - from ._models import InMageAzureV2ManagedDiskDetails # type: ignore - from ._models import InMageAzureV2PolicyDetails # type: ignore - from ._models import InMageAzureV2PolicyInput # type: ignore - from ._models import InMageAzureV2ProtectedDiskDetails # type: ignore - from ._models import InMageAzureV2RecoveryPointDetails # type: ignore - from ._models import InMageAzureV2ReplicationDetails # type: ignore - from ._models import InMageAzureV2ReprotectInput # type: ignore - from ._models import InMageAzureV2TestFailoverInput # type: ignore - from ._models import InMageAzureV2UnplannedFailoverInput # type: ignore - from ._models import InMageAzureV2UpdateReplicationProtectedItemInput # type: ignore - from ._models import InMageBasePolicyDetails # type: ignore - from ._models import InMageDisableProtectionProviderSpecificInput # type: ignore - from ._models import InMageDiskDetails # type: ignore - from ._models import InMageDiskExclusionInput # type: ignore - from ._models import InMageDiskSignatureExclusionOptions # type: ignore - from ._models import InMageEnableProtectionInput # type: ignore - from ._models import InMagePolicyDetails # type: ignore - from ._models import InMagePolicyInput # type: ignore - from ._models import InMageProtectedDiskDetails # type: ignore - from ._models import InMageRcmAgentUpgradeBlockingErrorDetails # type: ignore - from ._models import InMageRcmApplyRecoveryPointInput # type: ignore - from ._models import InMageRcmDiscoveredProtectedVmDetails # type: ignore - from ._models import InMageRcmDiskInput # type: ignore - from ._models import InMageRcmDisksDefaultInput # type: ignore - from ._models import InMageRcmEnableProtectionInput # type: ignore - from ._models import InMageRcmEventDetails # type: ignore - from ._models import InMageRcmFabricCreationInput # type: ignore - from ._models import InMageRcmFabricSpecificDetails # type: ignore - from ._models import InMageRcmFailbackDiscoveredProtectedVmDetails # type: ignore - from ._models import InMageRcmFailbackEventDetails # type: ignore - from ._models import InMageRcmFailbackMobilityAgentDetails # type: ignore - from ._models import InMageRcmFailbackNicDetails # type: ignore - from ._models import InMageRcmFailbackPlannedFailoverProviderInput # type: ignore - from ._models import InMageRcmFailbackPolicyCreationInput # type: ignore - from ._models import InMageRcmFailbackPolicyDetails # type: ignore - from ._models import InMageRcmFailbackProtectedDiskDetails # type: ignore - from ._models import InMageRcmFailbackReplicationDetails # type: ignore - from ._models import InMageRcmFailbackReprotectInput # type: ignore - from ._models import InMageRcmFailbackSyncDetails # type: ignore - from ._models import InMageRcmLastAgentUpgradeErrorDetails # type: ignore - from ._models import InMageRcmMobilityAgentDetails # type: ignore - from ._models import InMageRcmNicDetails # type: ignore - from ._models import InMageRcmNicInput # type: ignore - from ._models import InMageRcmPolicyCreationInput # type: ignore - from ._models import InMageRcmPolicyDetails # type: ignore - from ._models import InMageRcmProtectedDiskDetails # type: ignore - from ._models import InMageRcmProtectionContainerMappingDetails # type: ignore - from ._models import InMageRcmRecoveryPointDetails # type: ignore - from ._models import InMageRcmReplicationDetails # type: ignore - from ._models import InMageRcmReprotectInput # type: ignore - from ._models import InMageRcmSyncDetails # type: ignore - from ._models import InMageRcmTestFailoverInput # type: ignore - from ._models import InMageRcmUnplannedFailoverInput # type: ignore - from ._models import InMageRcmUpdateApplianceForReplicationProtectedItemInput # type: ignore - from ._models import InMageRcmUpdateContainerMappingInput # type: ignore - from ._models import InMageRcmUpdateReplicationProtectedItemInput # type: ignore - from ._models import InMageReplicationDetails # type: ignore - from ._models import InMageReprotectInput # type: ignore - from ._models import InMageTestFailoverInput # type: ignore - from ._models import InMageUnplannedFailoverInput # type: ignore - from ._models import InMageVolumeExclusionOptions # type: ignore - from ._models import InconsistentVmDetails # type: ignore - from ._models import InitialReplicationDetails # type: ignore - from ._models import InlineWorkflowTaskDetails # type: ignore - from ._models import InnerHealthError # type: ignore - from ._models import InputEndpoint # type: ignore - from ._models import Job # type: ignore - from ._models import JobCollection # type: ignore - from ._models import JobDetails # type: ignore - from ._models import JobEntity # type: ignore - from ._models import JobErrorDetails # type: ignore - from ._models import JobProperties # type: ignore - from ._models import JobQueryParameter # type: ignore - from ._models import JobStatusEventDetails # type: ignore - from ._models import JobTaskDetails # type: ignore - from ._models import KeyEncryptionKeyInfo # type: ignore - from ._models import LogicalNetwork # type: ignore - from ._models import LogicalNetworkCollection # type: ignore - from ._models import LogicalNetworkProperties # type: ignore - from ._models import ManualActionTaskDetails # type: ignore - from ._models import MarsAgentDetails # type: ignore - from ._models import MasterTargetServer # type: ignore - from ._models import MigrateInput # type: ignore - from ._models import MigrateInputProperties # type: ignore - from ._models import MigrateProviderSpecificInput # type: ignore - from ._models import MigrationItem # type: ignore - from ._models import MigrationItemCollection # type: ignore - from ._models import MigrationItemProperties # type: ignore - from ._models import MigrationItemsQueryParameter # type: ignore - from ._models import MigrationProviderSpecificSettings # type: ignore - from ._models import MigrationRecoveryPoint # type: ignore - from ._models import MigrationRecoveryPointCollection # type: ignore - from ._models import MigrationRecoveryPointProperties # type: ignore - from ._models import MobilityServiceUpdate # type: ignore - from ._models import Network # type: ignore - from ._models import NetworkCollection # type: ignore - from ._models import NetworkMapping # type: ignore - from ._models import NetworkMappingCollection # type: ignore - from ._models import NetworkMappingFabricSpecificSettings # type: ignore - from ._models import NetworkMappingProperties # type: ignore - from ._models import NetworkProperties # type: ignore - from ._models import NewProtectionProfile # type: ignore - from ._models import NewRecoveryVirtualNetwork # type: ignore - from ._models import OSDetails # type: ignore - from ._models import OSDiskDetails # type: ignore - from ._models import OSVersionWrapper # type: ignore - from ._models import OperationsDiscovery # type: ignore - from ._models import OperationsDiscoveryCollection # type: ignore - from ._models import PlannedFailoverInput # type: ignore - from ._models import PlannedFailoverInputProperties # type: ignore - from ._models import PlannedFailoverProviderSpecificFailoverInput # type: ignore - from ._models import Policy # type: ignore - from ._models import PolicyCollection # type: ignore - from ._models import PolicyProperties # type: ignore - from ._models import PolicyProviderSpecificDetails # type: ignore - from ._models import PolicyProviderSpecificInput # type: ignore - from ._models import ProcessServer # type: ignore - from ._models import ProcessServerDetails # type: ignore - from ._models import ProtectableItem # type: ignore - from ._models import ProtectableItemCollection # type: ignore - from ._models import ProtectableItemProperties # type: ignore - from ._models import ProtectableItemQueryParameter # type: ignore - from ._models import ProtectedItemsQueryParameter # type: ignore - from ._models import ProtectionContainer # type: ignore - from ._models import ProtectionContainerCollection # type: ignore - from ._models import ProtectionContainerFabricSpecificDetails # type: ignore - from ._models import ProtectionContainerMapping # type: ignore - from ._models import ProtectionContainerMappingCollection # type: ignore - from ._models import ProtectionContainerMappingProperties # type: ignore - from ._models import ProtectionContainerMappingProviderSpecificDetails # type: ignore - from ._models import ProtectionContainerProperties # type: ignore - from ._models import ProtectionProfileCustomDetails # type: ignore - from ._models import ProviderError # type: ignore - from ._models import ProviderSpecificRecoveryPointDetails # type: ignore - from ._models import PushInstallerDetails # type: ignore - from ._models import RcmProxyDetails # type: ignore - from ._models import RecoveryAvailabilitySetCustomDetails # type: ignore - from ._models import RecoveryPlan # type: ignore - from ._models import RecoveryPlanA2ADetails # type: ignore - from ._models import RecoveryPlanA2AFailoverInput # type: ignore - from ._models import RecoveryPlanA2AInput # type: ignore - from ._models import RecoveryPlanAction # type: ignore - from ._models import RecoveryPlanActionDetails # type: ignore - from ._models import RecoveryPlanAutomationRunbookActionDetails # type: ignore - from ._models import RecoveryPlanCollection # type: ignore - from ._models import RecoveryPlanGroup # type: ignore - from ._models import RecoveryPlanGroupTaskDetails # type: ignore - from ._models import RecoveryPlanHyperVReplicaAzureFailbackInput # type: ignore - from ._models import RecoveryPlanHyperVReplicaAzureFailoverInput # type: ignore - from ._models import RecoveryPlanInMageAzureV2FailoverInput # type: ignore - from ._models import RecoveryPlanInMageFailoverInput # type: ignore - from ._models import RecoveryPlanInMageRcmFailbackFailoverInput # type: ignore - from ._models import RecoveryPlanInMageRcmFailoverInput # type: ignore - from ._models import RecoveryPlanManualActionDetails # type: ignore - from ._models import RecoveryPlanPlannedFailoverInput # type: ignore - from ._models import RecoveryPlanPlannedFailoverInputProperties # type: ignore - from ._models import RecoveryPlanProperties # type: ignore - from ._models import RecoveryPlanProtectedItem # type: ignore - from ._models import RecoveryPlanProviderSpecificDetails # type: ignore - from ._models import RecoveryPlanProviderSpecificFailoverInput # type: ignore - from ._models import RecoveryPlanProviderSpecificInput # type: ignore - from ._models import RecoveryPlanScriptActionDetails # type: ignore - from ._models import RecoveryPlanShutdownGroupTaskDetails # type: ignore - from ._models import RecoveryPlanTestFailoverCleanupInput # type: ignore - from ._models import RecoveryPlanTestFailoverCleanupInputProperties # type: ignore - from ._models import RecoveryPlanTestFailoverInput # type: ignore - from ._models import RecoveryPlanTestFailoverInputProperties # type: ignore - from ._models import RecoveryPlanUnplannedFailoverInput # type: ignore - from ._models import RecoveryPlanUnplannedFailoverInputProperties # type: ignore - from ._models import RecoveryPoint # type: ignore - from ._models import RecoveryPointCollection # type: ignore - from ._models import RecoveryPointProperties # type: ignore - from ._models import RecoveryProximityPlacementGroupCustomDetails # type: ignore - from ._models import RecoveryResourceGroupCustomDetails # type: ignore - from ._models import RecoveryServicesProvider # type: ignore - from ._models import RecoveryServicesProviderCollection # type: ignore - from ._models import RecoveryServicesProviderProperties # type: ignore - from ._models import RecoveryVirtualNetworkCustomDetails # type: ignore - from ._models import RemoveDisksInput # type: ignore - from ._models import RemoveDisksInputProperties # type: ignore - from ._models import RemoveDisksProviderSpecificInput # type: ignore - from ._models import RemoveProtectionContainerMappingInput # type: ignore - from ._models import RemoveProtectionContainerMappingInputProperties # type: ignore - from ._models import RenewCertificateInput # type: ignore - from ._models import RenewCertificateInputProperties # type: ignore - from ._models import ReplicationAgentDetails # type: ignore - from ._models import ReplicationEligibilityResults # type: ignore - from ._models import ReplicationEligibilityResultsCollection # type: ignore - from ._models import ReplicationEligibilityResultsErrorInfo # type: ignore - from ._models import ReplicationEligibilityResultsProperties # type: ignore - from ._models import ReplicationGroupDetails # type: ignore - from ._models import ReplicationProtectedItem # type: ignore - from ._models import ReplicationProtectedItemCollection # type: ignore - from ._models import ReplicationProtectedItemProperties # type: ignore - from ._models import ReplicationProtectionIntent # type: ignore - from ._models import ReplicationProtectionIntentCollection # type: ignore - from ._models import ReplicationProtectionIntentProperties # type: ignore - from ._models import ReplicationProtectionIntentProviderSpecificSettings # type: ignore - from ._models import ReplicationProviderContainerUnmappingInput # type: ignore - from ._models import ReplicationProviderSpecificContainerCreationInput # type: ignore - from ._models import ReplicationProviderSpecificContainerMappingInput # type: ignore - from ._models import ReplicationProviderSpecificSettings # type: ignore - from ._models import ReplicationProviderSpecificUpdateContainerMappingInput # type: ignore - from ._models import ReprotectAgentDetails # type: ignore - from ._models import ResolveHealthError # type: ignore - from ._models import ResolveHealthInput # type: ignore - from ._models import ResolveHealthInputProperties # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceHealthSummary # type: ignore - from ._models import ResumeJobParams # type: ignore - from ._models import ResumeJobParamsProperties # type: ignore - from ._models import ResyncInput # type: ignore - from ._models import ResyncInputProperties # type: ignore - from ._models import ResyncProviderSpecificInput # type: ignore - from ._models import RetentionVolume # type: ignore - from ._models import ReverseReplicationInput # type: ignore - from ._models import ReverseReplicationInputProperties # type: ignore - from ._models import ReverseReplicationProviderSpecificInput # type: ignore - from ._models import RoleAssignment # type: ignore - from ._models import RunAsAccount # type: ignore - from ._models import ScriptActionTaskDetails # type: ignore - from ._models import ServiceError # type: ignore - from ._models import StorageAccountCustomDetails # type: ignore - from ._models import StorageClassification # type: ignore - from ._models import StorageClassificationCollection # type: ignore - from ._models import StorageClassificationMapping # type: ignore - from ._models import StorageClassificationMappingCollection # type: ignore - from ._models import StorageClassificationMappingInput # type: ignore - from ._models import StorageClassificationMappingProperties # type: ignore - from ._models import StorageClassificationProperties # type: ignore - from ._models import StorageMappingInputProperties # type: ignore - from ._models import Subnet # type: ignore - from ._models import SupportedOSDetails # type: ignore - from ._models import SupportedOSProperties # type: ignore - from ._models import SupportedOSProperty # type: ignore - from ._models import SupportedOperatingSystems # type: ignore - from ._models import SwitchProtectionInput # type: ignore - from ._models import SwitchProtectionInputProperties # type: ignore - from ._models import SwitchProtectionJobDetails # type: ignore - from ._models import SwitchProtectionProviderSpecificInput # type: ignore - from ._models import TargetComputeSize # type: ignore - from ._models import TargetComputeSizeCollection # type: ignore - from ._models import TargetComputeSizeProperties # type: ignore - from ._models import TaskTypeDetails # type: ignore - from ._models import TestFailoverCleanupInput # type: ignore - from ._models import TestFailoverCleanupInputProperties # type: ignore - from ._models import TestFailoverInput # type: ignore - from ._models import TestFailoverInputProperties # type: ignore - from ._models import TestFailoverJobDetails # type: ignore - from ._models import TestFailoverProviderSpecificInput # type: ignore - from ._models import TestMigrateCleanupInput # type: ignore - from ._models import TestMigrateCleanupInputProperties # type: ignore - from ._models import TestMigrateInput # type: ignore - from ._models import TestMigrateInputProperties # type: ignore - from ._models import TestMigrateProviderSpecificInput # type: ignore - from ._models import UnplannedFailoverInput # type: ignore - from ._models import UnplannedFailoverInputProperties # type: ignore - from ._models import UnplannedFailoverProviderSpecificInput # type: ignore - from ._models import UpdateApplianceForReplicationProtectedItemInput # type: ignore - from ._models import UpdateApplianceForReplicationProtectedItemInputProperties # type: ignore - from ._models import UpdateApplianceForReplicationProtectedItemProviderSpecificInput # type: ignore - from ._models import UpdateDiskInput # type: ignore - from ._models import UpdateMigrationItemInput # type: ignore - from ._models import UpdateMigrationItemInputProperties # type: ignore - from ._models import UpdateMigrationItemProviderSpecificInput # type: ignore - from ._models import UpdateMobilityServiceRequest # type: ignore - from ._models import UpdateMobilityServiceRequestProperties # type: ignore - from ._models import UpdateNetworkMappingInput # type: ignore - from ._models import UpdateNetworkMappingInputProperties # type: ignore - from ._models import UpdatePolicyInput # type: ignore - from ._models import UpdatePolicyInputProperties # type: ignore - from ._models import UpdateProtectionContainerMappingInput # type: ignore - from ._models import UpdateProtectionContainerMappingInputProperties # type: ignore - from ._models import UpdateRecoveryPlanInput # type: ignore - from ._models import UpdateRecoveryPlanInputProperties # type: ignore - from ._models import UpdateReplicationProtectedItemInput # type: ignore - from ._models import UpdateReplicationProtectedItemInputProperties # type: ignore - from ._models import UpdateReplicationProtectedItemProviderInput # type: ignore - from ._models import UpdateVCenterRequest # type: ignore - from ._models import UpdateVCenterRequestProperties # type: ignore - from ._models import VCenter # type: ignore - from ._models import VCenterCollection # type: ignore - from ._models import VCenterProperties # type: ignore - from ._models import VMNicDetails # type: ignore - from ._models import VMNicInputDetails # type: ignore - from ._models import VMwareCbtContainerCreationInput # type: ignore - from ._models import VMwareCbtContainerMappingInput # type: ignore - from ._models import VMwareCbtDiskInput # type: ignore - from ._models import VMwareCbtEnableMigrationInput # type: ignore - from ._models import VMwareCbtEventDetails # type: ignore - from ._models import VMwareCbtMigrateInput # type: ignore - from ._models import VMwareCbtMigrationDetails # type: ignore - from ._models import VMwareCbtNicDetails # type: ignore - from ._models import VMwareCbtNicInput # type: ignore - from ._models import VMwareCbtPolicyCreationInput # type: ignore - from ._models import VMwareCbtProtectedDiskDetails # type: ignore - from ._models import VMwareCbtProtectionContainerMappingDetails # type: ignore - from ._models import VMwareCbtResyncInput # type: ignore - from ._models import VMwareCbtTestMigrateInput # type: ignore - from ._models import VMwareCbtUpdateDiskInput # type: ignore - from ._models import VMwareCbtUpdateMigrationItemInput # type: ignore - from ._models import VMwareDetails # type: ignore - from ._models import VMwareV2FabricCreationInput # type: ignore - from ._models import VMwareV2FabricSpecificDetails # type: ignore - from ._models import VMwareVirtualMachineDetails # type: ignore - from ._models import VaultHealthDetails # type: ignore - from ._models import VaultHealthProperties # type: ignore - from ._models import VaultSetting # type: ignore - from ._models import VaultSettingCollection # type: ignore - from ._models import VaultSettingCreationInput # type: ignore - from ._models import VaultSettingCreationInputProperties # type: ignore - from ._models import VaultSettingProperties # type: ignore - from ._models import VersionDetails # type: ignore - from ._models import VirtualMachineTaskDetails # type: ignore - from ._models import VmNicUpdatesTaskDetails # type: ignore - from ._models import VmmDetails # type: ignore - from ._models import VmmToAzureCreateNetworkMappingInput # type: ignore - from ._models import VmmToAzureNetworkMappingSettings # type: ignore - from ._models import VmmToAzureUpdateNetworkMappingInput # type: ignore - from ._models import VmmToVmmCreateNetworkMappingInput # type: ignore - from ._models import VmmToVmmNetworkMappingSettings # type: ignore - from ._models import VmmToVmmUpdateNetworkMappingInput # type: ignore - from ._models import VmmVirtualMachineDetails # type: ignore - from ._models import VmwareCbtPolicyDetails # type: ignore +from ._models_py3 import A2AAddDisksInput +from ._models_py3 import A2AApplyRecoveryPointInput +from ._models_py3 import A2AContainerCreationInput +from ._models_py3 import A2AContainerMappingInput +from ._models_py3 import A2ACreateProtectionIntentInput +from ._models_py3 import A2ACrossClusterMigrationApplyRecoveryPointInput +from ._models_py3 import A2ACrossClusterMigrationContainerCreationInput +from ._models_py3 import A2ACrossClusterMigrationEnableProtectionInput +from ._models_py3 import A2ACrossClusterMigrationPolicyCreationInput +from ._models_py3 import A2ACrossClusterMigrationReplicationDetails +from ._models_py3 import A2AEnableProtectionInput +from ._models_py3 import A2AEventDetails +from ._models_py3 import A2APolicyCreationInput +from ._models_py3 import A2APolicyDetails +from ._models_py3 import A2AProtectedDiskDetails +from ._models_py3 import A2AProtectedManagedDiskDetails +from ._models_py3 import A2AProtectionContainerMappingDetails +from ._models_py3 import A2AProtectionIntentDiskInputDetails +from ._models_py3 import A2AProtectionIntentManagedDiskInputDetails +from ._models_py3 import A2ARecoveryPointDetails +from ._models_py3 import A2ARemoveDisksInput +from ._models_py3 import A2AReplicationDetails +from ._models_py3 import A2AReplicationIntentDetails +from ._models_py3 import A2AReprotectInput +from ._models_py3 import A2ASwitchProtectionInput +from ._models_py3 import A2ATestFailoverInput +from ._models_py3 import A2AUnplannedFailoverInput +from ._models_py3 import A2AUnprotectedDiskDetails +from ._models_py3 import A2AUpdateContainerMappingInput +from ._models_py3 import A2AUpdateReplicationProtectedItemInput +from ._models_py3 import A2AVmDiskInputDetails +from ._models_py3 import A2AVmManagedDiskInputDetails +from ._models_py3 import A2AVmManagedDiskUpdateDetails +from ._models_py3 import A2AZoneDetails +from ._models_py3 import ASRTask +from ._models_py3 import AddDisksInput +from ._models_py3 import AddDisksInputProperties +from ._models_py3 import AddDisksProviderSpecificInput +from ._models_py3 import AddRecoveryServicesProviderInput +from ._models_py3 import AddRecoveryServicesProviderInputProperties +from ._models_py3 import AddVCenterRequest +from ._models_py3 import AddVCenterRequestProperties +from ._models_py3 import AgentDetails +from ._models_py3 import AgentDiskDetails +from ._models_py3 import Alert +from ._models_py3 import AlertCollection +from ._models_py3 import AlertProperties +from ._models_py3 import ApplianceCollection +from ._models_py3 import ApplianceQueryParameter +from ._models_py3 import ApplianceSpecificDetails +from ._models_py3 import ApplyRecoveryPointInput +from ._models_py3 import ApplyRecoveryPointInputProperties +from ._models_py3 import ApplyRecoveryPointProviderSpecificInput +from ._models_py3 import AsrJobDetails +from ._models_py3 import AutomationRunbookTaskDetails +from ._models_py3 import AzureFabricCreationInput +from ._models_py3 import AzureFabricSpecificDetails +from ._models_py3 import AzureToAzureCreateNetworkMappingInput +from ._models_py3 import AzureToAzureNetworkMappingSettings +from ._models_py3 import AzureToAzureUpdateNetworkMappingInput +from ._models_py3 import AzureToAzureVmSyncedConfigDetails +from ._models_py3 import AzureVmDiskDetails +from ._models_py3 import ComputeSizeErrorDetails +from ._models_py3 import ConfigurationSettings +from ._models_py3 import ConfigureAlertRequest +from ._models_py3 import ConfigureAlertRequestProperties +from ._models_py3 import ConsistencyCheckTaskDetails +from ._models_py3 import CreateNetworkMappingInput +from ._models_py3 import CreateNetworkMappingInputProperties +from ._models_py3 import CreatePolicyInput +from ._models_py3 import CreatePolicyInputProperties +from ._models_py3 import CreateProtectionContainerInput +from ._models_py3 import CreateProtectionContainerInputProperties +from ._models_py3 import CreateProtectionContainerMappingInput +from ._models_py3 import CreateProtectionContainerMappingInputProperties +from ._models_py3 import CreateProtectionIntentInput +from ._models_py3 import CreateProtectionIntentProperties +from ._models_py3 import CreateProtectionIntentProviderSpecificDetails +from ._models_py3 import CreateRecoveryPlanInput +from ._models_py3 import CreateRecoveryPlanInputProperties +from ._models_py3 import CriticalJobHistoryDetails +from ._models_py3 import CurrentJobDetails +from ._models_py3 import CurrentScenarioDetails +from ._models_py3 import DataStore +from ._models_py3 import DisableProtectionInput +from ._models_py3 import DisableProtectionInputProperties +from ._models_py3 import DisableProtectionProviderSpecificInput +from ._models_py3 import DiscoverProtectableItemRequest +from ._models_py3 import DiscoverProtectableItemRequestProperties +from ._models_py3 import DiskDetails +from ._models_py3 import DiskEncryptionInfo +from ._models_py3 import DiskEncryptionKeyInfo +from ._models_py3 import DiskVolumeDetails +from ._models_py3 import Display +from ._models_py3 import DraDetails +from ._models_py3 import EnableMigrationInput +from ._models_py3 import EnableMigrationInputProperties +from ._models_py3 import EnableMigrationProviderSpecificInput +from ._models_py3 import EnableProtectionInput +from ._models_py3 import EnableProtectionInputProperties +from ._models_py3 import EnableProtectionProviderSpecificInput +from ._models_py3 import EncryptionDetails +from ._models_py3 import Event +from ._models_py3 import EventCollection +from ._models_py3 import EventProperties +from ._models_py3 import EventProviderSpecificDetails +from ._models_py3 import EventQueryParameter +from ._models_py3 import EventSpecificDetails +from ._models_py3 import ExistingProtectionProfile +from ._models_py3 import ExistingRecoveryAvailabilitySet +from ._models_py3 import ExistingRecoveryProximityPlacementGroup +from ._models_py3 import ExistingRecoveryResourceGroup +from ._models_py3 import ExistingRecoveryVirtualNetwork +from ._models_py3 import ExistingStorageAccount +from ._models_py3 import ExportJobDetails +from ._models_py3 import ExtendedLocation +from ._models_py3 import Fabric +from ._models_py3 import FabricCollection +from ._models_py3 import FabricCreationInput +from ._models_py3 import FabricCreationInputProperties +from ._models_py3 import FabricProperties +from ._models_py3 import FabricQueryParameter +from ._models_py3 import FabricReplicationGroupTaskDetails +from ._models_py3 import FabricSpecificCreateNetworkMappingInput +from ._models_py3 import FabricSpecificCreationInput +from ._models_py3 import FabricSpecificDetails +from ._models_py3 import FabricSpecificUpdateNetworkMappingInput +from ._models_py3 import FailoverJobDetails +from ._models_py3 import FailoverProcessServerRequest +from ._models_py3 import FailoverProcessServerRequestProperties +from ._models_py3 import FailoverReplicationProtectedItemDetails +from ._models_py3 import GroupTaskDetails +from ._models_py3 import HealthError +from ._models_py3 import HealthErrorSummary +from ._models_py3 import HyperVHostDetails +from ._models_py3 import HyperVReplica2012EventDetails +from ._models_py3 import HyperVReplica2012R2EventDetails +from ._models_py3 import HyperVReplicaAzureApplyRecoveryPointInput +from ._models_py3 import HyperVReplicaAzureDiskInputDetails +from ._models_py3 import HyperVReplicaAzureEnableProtectionInput +from ._models_py3 import HyperVReplicaAzureEventDetails +from ._models_py3 import HyperVReplicaAzureFailbackProviderInput +from ._models_py3 import HyperVReplicaAzureManagedDiskDetails +from ._models_py3 import HyperVReplicaAzurePlannedFailoverProviderInput +from ._models_py3 import HyperVReplicaAzurePolicyDetails +from ._models_py3 import HyperVReplicaAzurePolicyInput +from ._models_py3 import HyperVReplicaAzureReplicationDetails +from ._models_py3 import HyperVReplicaAzureReprotectInput +from ._models_py3 import HyperVReplicaAzureTestFailoverInput +from ._models_py3 import HyperVReplicaAzureUnplannedFailoverInput +from ._models_py3 import HyperVReplicaAzureUpdateReplicationProtectedItemInput +from ._models_py3 import HyperVReplicaBaseEventDetails +from ._models_py3 import HyperVReplicaBasePolicyDetails +from ._models_py3 import HyperVReplicaBaseReplicationDetails +from ._models_py3 import HyperVReplicaBluePolicyDetails +from ._models_py3 import HyperVReplicaBluePolicyInput +from ._models_py3 import HyperVReplicaBlueReplicationDetails +from ._models_py3 import HyperVReplicaPolicyDetails +from ._models_py3 import HyperVReplicaPolicyInput +from ._models_py3 import HyperVReplicaReplicationDetails +from ._models_py3 import HyperVSiteDetails +from ._models_py3 import HyperVVirtualMachineDetails +from ._models_py3 import IPConfigDetails +from ._models_py3 import IPConfigInputDetails +from ._models_py3 import IdentityProviderDetails +from ._models_py3 import IdentityProviderInput +from ._models_py3 import InMageAgentDetails +from ._models_py3 import InMageAzureV2ApplyRecoveryPointInput +from ._models_py3 import InMageAzureV2DiskInputDetails +from ._models_py3 import InMageAzureV2EnableProtectionInput +from ._models_py3 import InMageAzureV2EventDetails +from ._models_py3 import InMageAzureV2ManagedDiskDetails +from ._models_py3 import InMageAzureV2PolicyDetails +from ._models_py3 import InMageAzureV2PolicyInput +from ._models_py3 import InMageAzureV2ProtectedDiskDetails +from ._models_py3 import InMageAzureV2RecoveryPointDetails +from ._models_py3 import InMageAzureV2ReplicationDetails +from ._models_py3 import InMageAzureV2ReprotectInput +from ._models_py3 import InMageAzureV2SwitchProviderBlockingErrorDetails +from ._models_py3 import InMageAzureV2SwitchProviderDetails +from ._models_py3 import InMageAzureV2SwitchProviderInput +from ._models_py3 import InMageAzureV2TestFailoverInput +from ._models_py3 import InMageAzureV2UnplannedFailoverInput +from ._models_py3 import InMageAzureV2UpdateReplicationProtectedItemInput +from ._models_py3 import InMageBasePolicyDetails +from ._models_py3 import InMageDisableProtectionProviderSpecificInput +from ._models_py3 import InMageDiskDetails +from ._models_py3 import InMageDiskExclusionInput +from ._models_py3 import InMageDiskSignatureExclusionOptions +from ._models_py3 import InMageEnableProtectionInput +from ._models_py3 import InMageFabricSwitchProviderBlockingErrorDetails +from ._models_py3 import InMagePolicyDetails +from ._models_py3 import InMagePolicyInput +from ._models_py3 import InMageProtectedDiskDetails +from ._models_py3 import InMageRcmAgentUpgradeBlockingErrorDetails +from ._models_py3 import InMageRcmApplianceDetails +from ._models_py3 import InMageRcmApplianceSpecificDetails +from ._models_py3 import InMageRcmApplyRecoveryPointInput +from ._models_py3 import InMageRcmDiscoveredProtectedVmDetails +from ._models_py3 import InMageRcmDiskInput +from ._models_py3 import InMageRcmDisksDefaultInput +from ._models_py3 import InMageRcmEnableProtectionInput +from ._models_py3 import InMageRcmEventDetails +from ._models_py3 import InMageRcmFabricCreationInput +from ._models_py3 import InMageRcmFabricSpecificDetails +from ._models_py3 import InMageRcmFabricSwitchProviderBlockingErrorDetails +from ._models_py3 import InMageRcmFailbackDiscoveredProtectedVmDetails +from ._models_py3 import InMageRcmFailbackEventDetails +from ._models_py3 import InMageRcmFailbackMobilityAgentDetails +from ._models_py3 import InMageRcmFailbackNicDetails +from ._models_py3 import InMageRcmFailbackPlannedFailoverProviderInput +from ._models_py3 import InMageRcmFailbackPolicyCreationInput +from ._models_py3 import InMageRcmFailbackPolicyDetails +from ._models_py3 import InMageRcmFailbackProtectedDiskDetails +from ._models_py3 import InMageRcmFailbackReplicationDetails +from ._models_py3 import InMageRcmFailbackReprotectInput +from ._models_py3 import InMageRcmFailbackSyncDetails +from ._models_py3 import InMageRcmLastAgentUpgradeErrorDetails +from ._models_py3 import InMageRcmMobilityAgentDetails +from ._models_py3 import InMageRcmNicDetails +from ._models_py3 import InMageRcmNicInput +from ._models_py3 import InMageRcmPolicyCreationInput +from ._models_py3 import InMageRcmPolicyDetails +from ._models_py3 import InMageRcmProtectedDiskDetails +from ._models_py3 import InMageRcmProtectionContainerMappingDetails +from ._models_py3 import InMageRcmRecoveryPointDetails +from ._models_py3 import InMageRcmReplicationDetails +from ._models_py3 import InMageRcmReprotectInput +from ._models_py3 import InMageRcmSyncDetails +from ._models_py3 import InMageRcmTestFailoverInput +from ._models_py3 import InMageRcmUnplannedFailoverInput +from ._models_py3 import InMageRcmUpdateApplianceForReplicationProtectedItemInput +from ._models_py3 import InMageRcmUpdateContainerMappingInput +from ._models_py3 import InMageRcmUpdateReplicationProtectedItemInput +from ._models_py3 import InMageReplicationDetails +from ._models_py3 import InMageReprotectInput +from ._models_py3 import InMageTestFailoverInput +from ._models_py3 import InMageUnplannedFailoverInput +from ._models_py3 import InMageVolumeExclusionOptions +from ._models_py3 import InconsistentVmDetails +from ._models_py3 import InitialReplicationDetails +from ._models_py3 import InlineWorkflowTaskDetails +from ._models_py3 import InnerHealthError +from ._models_py3 import InputEndpoint +from ._models_py3 import Job +from ._models_py3 import JobCollection +from ._models_py3 import JobDetails +from ._models_py3 import JobEntity +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobProperties +from ._models_py3 import JobQueryParameter +from ._models_py3 import JobStatusEventDetails +from ._models_py3 import JobTaskDetails +from ._models_py3 import KeyEncryptionKeyInfo +from ._models_py3 import LogicalNetwork +from ._models_py3 import LogicalNetworkCollection +from ._models_py3 import LogicalNetworkProperties +from ._models_py3 import ManualActionTaskDetails +from ._models_py3 import MarsAgentDetails +from ._models_py3 import MasterTargetServer +from ._models_py3 import MigrateInput +from ._models_py3 import MigrateInputProperties +from ._models_py3 import MigrateProviderSpecificInput +from ._models_py3 import MigrationItem +from ._models_py3 import MigrationItemCollection +from ._models_py3 import MigrationItemProperties +from ._models_py3 import MigrationItemsQueryParameter +from ._models_py3 import MigrationProviderSpecificSettings +from ._models_py3 import MigrationRecoveryPoint +from ._models_py3 import MigrationRecoveryPointCollection +from ._models_py3 import MigrationRecoveryPointProperties +from ._models_py3 import MobilityServiceUpdate +from ._models_py3 import Network +from ._models_py3 import NetworkCollection +from ._models_py3 import NetworkMapping +from ._models_py3 import NetworkMappingCollection +from ._models_py3 import NetworkMappingFabricSpecificSettings +from ._models_py3 import NetworkMappingProperties +from ._models_py3 import NetworkProperties +from ._models_py3 import NewProtectionProfile +from ._models_py3 import NewRecoveryVirtualNetwork +from ._models_py3 import OSDetails +from ._models_py3 import OSDiskDetails +from ._models_py3 import OSVersionWrapper +from ._models_py3 import OperationsDiscovery +from ._models_py3 import OperationsDiscoveryCollection +from ._models_py3 import PauseReplicationInput +from ._models_py3 import PauseReplicationInputProperties +from ._models_py3 import PlannedFailoverInput +from ._models_py3 import PlannedFailoverInputProperties +from ._models_py3 import PlannedFailoverProviderSpecificFailoverInput +from ._models_py3 import Policy +from ._models_py3 import PolicyCollection +from ._models_py3 import PolicyProperties +from ._models_py3 import PolicyProviderSpecificDetails +from ._models_py3 import PolicyProviderSpecificInput +from ._models_py3 import ProcessServer +from ._models_py3 import ProcessServerDetails +from ._models_py3 import ProtectableItem +from ._models_py3 import ProtectableItemCollection +from ._models_py3 import ProtectableItemProperties +from ._models_py3 import ProtectableItemQueryParameter +from ._models_py3 import ProtectedItemsQueryParameter +from ._models_py3 import ProtectionContainer +from ._models_py3 import ProtectionContainerCollection +from ._models_py3 import ProtectionContainerFabricSpecificDetails +from ._models_py3 import ProtectionContainerMapping +from ._models_py3 import ProtectionContainerMappingCollection +from ._models_py3 import ProtectionContainerMappingProperties +from ._models_py3 import ProtectionContainerMappingProviderSpecificDetails +from ._models_py3 import ProtectionContainerProperties +from ._models_py3 import ProtectionProfileCustomDetails +from ._models_py3 import ProviderError +from ._models_py3 import ProviderSpecificRecoveryPointDetails +from ._models_py3 import PushInstallerDetails +from ._models_py3 import RcmProxyDetails +from ._models_py3 import RecoveryAvailabilitySetCustomDetails +from ._models_py3 import RecoveryPlan +from ._models_py3 import RecoveryPlanA2ADetails +from ._models_py3 import RecoveryPlanA2AFailoverInput +from ._models_py3 import RecoveryPlanA2AInput +from ._models_py3 import RecoveryPlanAction +from ._models_py3 import RecoveryPlanActionDetails +from ._models_py3 import RecoveryPlanAutomationRunbookActionDetails +from ._models_py3 import RecoveryPlanCollection +from ._models_py3 import RecoveryPlanGroup +from ._models_py3 import RecoveryPlanGroupTaskDetails +from ._models_py3 import RecoveryPlanHyperVReplicaAzureFailbackInput +from ._models_py3 import RecoveryPlanHyperVReplicaAzureFailoverInput +from ._models_py3 import RecoveryPlanInMageAzureV2FailoverInput +from ._models_py3 import RecoveryPlanInMageFailoverInput +from ._models_py3 import RecoveryPlanInMageRcmFailbackFailoverInput +from ._models_py3 import RecoveryPlanInMageRcmFailoverInput +from ._models_py3 import RecoveryPlanManualActionDetails +from ._models_py3 import RecoveryPlanPlannedFailoverInput +from ._models_py3 import RecoveryPlanPlannedFailoverInputProperties +from ._models_py3 import RecoveryPlanProperties +from ._models_py3 import RecoveryPlanProtectedItem +from ._models_py3 import RecoveryPlanProviderSpecificDetails +from ._models_py3 import RecoveryPlanProviderSpecificFailoverInput +from ._models_py3 import RecoveryPlanProviderSpecificInput +from ._models_py3 import RecoveryPlanScriptActionDetails +from ._models_py3 import RecoveryPlanShutdownGroupTaskDetails +from ._models_py3 import RecoveryPlanTestFailoverCleanupInput +from ._models_py3 import RecoveryPlanTestFailoverCleanupInputProperties +from ._models_py3 import RecoveryPlanTestFailoverInput +from ._models_py3 import RecoveryPlanTestFailoverInputProperties +from ._models_py3 import RecoveryPlanUnplannedFailoverInput +from ._models_py3 import RecoveryPlanUnplannedFailoverInputProperties +from ._models_py3 import RecoveryPoint +from ._models_py3 import RecoveryPointCollection +from ._models_py3 import RecoveryPointProperties +from ._models_py3 import RecoveryProximityPlacementGroupCustomDetails +from ._models_py3 import RecoveryResourceGroupCustomDetails +from ._models_py3 import RecoveryServicesProvider +from ._models_py3 import RecoveryServicesProviderCollection +from ._models_py3 import RecoveryServicesProviderProperties +from ._models_py3 import RecoveryVirtualNetworkCustomDetails +from ._models_py3 import RemoveDisksInput +from ._models_py3 import RemoveDisksInputProperties +from ._models_py3 import RemoveDisksProviderSpecificInput +from ._models_py3 import RemoveProtectionContainerMappingInput +from ._models_py3 import RemoveProtectionContainerMappingInputProperties +from ._models_py3 import RenewCertificateInput +from ._models_py3 import RenewCertificateInputProperties +from ._models_py3 import ReplicationAgentDetails +from ._models_py3 import ReplicationAppliance +from ._models_py3 import ReplicationApplianceProperties +from ._models_py3 import ReplicationEligibilityResults +from ._models_py3 import ReplicationEligibilityResultsCollection +from ._models_py3 import ReplicationEligibilityResultsErrorInfo +from ._models_py3 import ReplicationEligibilityResultsProperties +from ._models_py3 import ReplicationGroupDetails +from ._models_py3 import ReplicationProtectedItem +from ._models_py3 import ReplicationProtectedItemCollection +from ._models_py3 import ReplicationProtectedItemProperties +from ._models_py3 import ReplicationProtectionIntent +from ._models_py3 import ReplicationProtectionIntentCollection +from ._models_py3 import ReplicationProtectionIntentProperties +from ._models_py3 import ReplicationProtectionIntentProviderSpecificSettings +from ._models_py3 import ReplicationProviderContainerUnmappingInput +from ._models_py3 import ReplicationProviderSpecificContainerCreationInput +from ._models_py3 import ReplicationProviderSpecificContainerMappingInput +from ._models_py3 import ReplicationProviderSpecificSettings +from ._models_py3 import ReplicationProviderSpecificUpdateContainerMappingInput +from ._models_py3 import ReprotectAgentDetails +from ._models_py3 import ResolveHealthError +from ._models_py3 import ResolveHealthInput +from ._models_py3 import ResolveHealthInputProperties +from ._models_py3 import Resource +from ._models_py3 import ResourceHealthSummary +from ._models_py3 import ResumeJobParams +from ._models_py3 import ResumeJobParamsProperties +from ._models_py3 import ResumeReplicationInput +from ._models_py3 import ResumeReplicationInputProperties +from ._models_py3 import ResumeReplicationProviderSpecificInput +from ._models_py3 import ResyncInput +from ._models_py3 import ResyncInputProperties +from ._models_py3 import ResyncProviderSpecificInput +from ._models_py3 import RetentionVolume +from ._models_py3 import ReverseReplicationInput +from ._models_py3 import ReverseReplicationInputProperties +from ._models_py3 import ReverseReplicationProviderSpecificInput +from ._models_py3 import RoleAssignment +from ._models_py3 import RunAsAccount +from ._models_py3 import ScriptActionTaskDetails +from ._models_py3 import ServiceError +from ._models_py3 import StorageAccountCustomDetails +from ._models_py3 import StorageClassification +from ._models_py3 import StorageClassificationCollection +from ._models_py3 import StorageClassificationMapping +from ._models_py3 import StorageClassificationMappingCollection +from ._models_py3 import StorageClassificationMappingInput +from ._models_py3 import StorageClassificationMappingProperties +from ._models_py3 import StorageClassificationProperties +from ._models_py3 import StorageMappingInputProperties +from ._models_py3 import Subnet +from ._models_py3 import SupportedOSDetails +from ._models_py3 import SupportedOSProperties +from ._models_py3 import SupportedOSProperty +from ._models_py3 import SupportedOperatingSystems +from ._models_py3 import SwitchProtectionInput +from ._models_py3 import SwitchProtectionInputProperties +from ._models_py3 import SwitchProtectionJobDetails +from ._models_py3 import SwitchProtectionProviderSpecificInput +from ._models_py3 import SwitchProviderInput +from ._models_py3 import SwitchProviderInputProperties +from ._models_py3 import SwitchProviderSpecificInput +from ._models_py3 import TargetComputeSize +from ._models_py3 import TargetComputeSizeCollection +from ._models_py3 import TargetComputeSizeProperties +from ._models_py3 import TaskTypeDetails +from ._models_py3 import TestFailoverCleanupInput +from ._models_py3 import TestFailoverCleanupInputProperties +from ._models_py3 import TestFailoverInput +from ._models_py3 import TestFailoverInputProperties +from ._models_py3 import TestFailoverJobDetails +from ._models_py3 import TestFailoverProviderSpecificInput +from ._models_py3 import TestMigrateCleanupInput +from ._models_py3 import TestMigrateCleanupInputProperties +from ._models_py3 import TestMigrateInput +from ._models_py3 import TestMigrateInputProperties +from ._models_py3 import TestMigrateProviderSpecificInput +from ._models_py3 import UnplannedFailoverInput +from ._models_py3 import UnplannedFailoverInputProperties +from ._models_py3 import UnplannedFailoverProviderSpecificInput +from ._models_py3 import UpdateApplianceForReplicationProtectedItemInput +from ._models_py3 import UpdateApplianceForReplicationProtectedItemInputProperties +from ._models_py3 import UpdateApplianceForReplicationProtectedItemProviderSpecificInput +from ._models_py3 import UpdateDiskInput +from ._models_py3 import UpdateMigrationItemInput +from ._models_py3 import UpdateMigrationItemInputProperties +from ._models_py3 import UpdateMigrationItemProviderSpecificInput +from ._models_py3 import UpdateMobilityServiceRequest +from ._models_py3 import UpdateMobilityServiceRequestProperties +from ._models_py3 import UpdateNetworkMappingInput +from ._models_py3 import UpdateNetworkMappingInputProperties +from ._models_py3 import UpdatePolicyInput +from ._models_py3 import UpdatePolicyInputProperties +from ._models_py3 import UpdateProtectionContainerMappingInput +from ._models_py3 import UpdateProtectionContainerMappingInputProperties +from ._models_py3 import UpdateRecoveryPlanInput +from ._models_py3 import UpdateRecoveryPlanInputProperties +from ._models_py3 import UpdateReplicationProtectedItemInput +from ._models_py3 import UpdateReplicationProtectedItemInputProperties +from ._models_py3 import UpdateReplicationProtectedItemProviderInput +from ._models_py3 import UpdateVCenterRequest +from ._models_py3 import UpdateVCenterRequestProperties +from ._models_py3 import VCenter +from ._models_py3 import VCenterCollection +from ._models_py3 import VCenterProperties +from ._models_py3 import VMNicDetails +from ._models_py3 import VMNicInputDetails +from ._models_py3 import VMwareCbtContainerCreationInput +from ._models_py3 import VMwareCbtContainerMappingInput +from ._models_py3 import VMwareCbtDiskInput +from ._models_py3 import VMwareCbtEnableMigrationInput +from ._models_py3 import VMwareCbtEventDetails +from ._models_py3 import VMwareCbtMigrateInput +from ._models_py3 import VMwareCbtMigrationDetails +from ._models_py3 import VMwareCbtNicDetails +from ._models_py3 import VMwareCbtNicInput +from ._models_py3 import VMwareCbtPolicyCreationInput +from ._models_py3 import VMwareCbtProtectedDiskDetails +from ._models_py3 import VMwareCbtProtectionContainerMappingDetails +from ._models_py3 import VMwareCbtResumeReplicationInput +from ._models_py3 import VMwareCbtResyncInput +from ._models_py3 import VMwareCbtTestMigrateInput +from ._models_py3 import VMwareCbtUpdateDiskInput +from ._models_py3 import VMwareCbtUpdateMigrationItemInput +from ._models_py3 import VMwareDetails +from ._models_py3 import VMwareV2FabricCreationInput +from ._models_py3 import VMwareV2FabricSpecificDetails +from ._models_py3 import VMwareVirtualMachineDetails +from ._models_py3 import VaultHealthDetails +from ._models_py3 import VaultHealthProperties +from ._models_py3 import VaultSetting +from ._models_py3 import VaultSettingCollection +from ._models_py3 import VaultSettingCreationInput +from ._models_py3 import VaultSettingCreationInputProperties +from ._models_py3 import VaultSettingProperties +from ._models_py3 import VersionDetails +from ._models_py3 import VirtualMachineTaskDetails +from ._models_py3 import VmNicUpdatesTaskDetails +from ._models_py3 import VmmDetails +from ._models_py3 import VmmToAzureCreateNetworkMappingInput +from ._models_py3 import VmmToAzureNetworkMappingSettings +from ._models_py3 import VmmToAzureUpdateNetworkMappingInput +from ._models_py3 import VmmToVmmCreateNetworkMappingInput +from ._models_py3 import VmmToVmmNetworkMappingSettings +from ._models_py3 import VmmToVmmUpdateNetworkMappingInput +from ._models_py3 import VmmVirtualMachineDetails +from ._models_py3 import VmwareCbtPolicyDetails -from ._site_recovery_management_client_enums import ( - A2ARecoveryAvailabilityType, - A2ARpRecoveryPointType, - AgentAutoUpdateStatus, - AgentUpgradeBlockedReason, - AgentVersionStatus, - AlternateLocationRecoveryOption, - AutoProtectionOfDataDisk, - DataSyncStatus, - DisableProtectionReason, - DiskAccountType, - DiskReplicationProgressHealth, - EthernetAddressType, - ExportJobOutputSerializationType, - FailoverDeploymentModel, - HealthErrorCategory, - HealthErrorCustomerResolvability, - HyperVReplicaAzureRpRecoveryPointType, - InMageRcmFailbackRecoveryPointType, - InMageV2RpRecoveryPointType, - LicenseType, - MigrationItemOperation, - MigrationRecoveryPointType, - MigrationState, - MobilityAgentUpgradeState, - MultiVmGroupCreateOption, - MultiVmSyncPointOption, - PlannedFailoverStatus, - PossibleOperationsDirections, - PresenceStatus, - ProtectionHealth, - RcmComponentStatus, - RecoveryPlanActionLocation, - RecoveryPlanGroupType, - RecoveryPlanPointType, - RecoveryPointSyncType, - RecoveryPointType, - ReplicationProtectedItemOperation, - ResyncState, - RpInMageRecoveryPointType, - SetMultiVmSyncStatus, - Severity, - SourceSiteOperations, - SqlServerLicenseType, - TestMigrationState, - VmEncryptionType, - VmReplicationProgressHealth, -) +from ._site_recovery_management_client_enums import A2ARecoveryAvailabilityType +from ._site_recovery_management_client_enums import A2ARpRecoveryPointType +from ._site_recovery_management_client_enums import AgentAutoUpdateStatus +from ._site_recovery_management_client_enums import AgentUpgradeBlockedReason +from ._site_recovery_management_client_enums import AgentVersionStatus +from ._site_recovery_management_client_enums import AlternateLocationRecoveryOption +from ._site_recovery_management_client_enums import AutoProtectionOfDataDisk +from ._site_recovery_management_client_enums import AutomationAccountAuthenticationType +from ._site_recovery_management_client_enums import DataSyncStatus +from ._site_recovery_management_client_enums import DisableProtectionReason +from ._site_recovery_management_client_enums import DiskAccountType +from ._site_recovery_management_client_enums import DiskReplicationProgressHealth +from ._site_recovery_management_client_enums import EthernetAddressType +from ._site_recovery_management_client_enums import ExportJobOutputSerializationType +from ._site_recovery_management_client_enums import ExtendedLocationType +from ._site_recovery_management_client_enums import FailoverDeploymentModel +from ._site_recovery_management_client_enums import HealthErrorCategory +from ._site_recovery_management_client_enums import HealthErrorCustomerResolvability +from ._site_recovery_management_client_enums import HyperVReplicaAzureRpRecoveryPointType +from ._site_recovery_management_client_enums import InMageRcmFailbackRecoveryPointType +from ._site_recovery_management_client_enums import InMageV2RpRecoveryPointType +from ._site_recovery_management_client_enums import LicenseType +from ._site_recovery_management_client_enums import MigrationItemOperation +from ._site_recovery_management_client_enums import MigrationRecoveryPointType +from ._site_recovery_management_client_enums import MigrationState +from ._site_recovery_management_client_enums import MobilityAgentUpgradeState +from ._site_recovery_management_client_enums import MultiVmGroupCreateOption +from ._site_recovery_management_client_enums import MultiVmSyncPointOption +from ._site_recovery_management_client_enums import PlannedFailoverStatus +from ._site_recovery_management_client_enums import PossibleOperationsDirections +from ._site_recovery_management_client_enums import PresenceStatus +from ._site_recovery_management_client_enums import ProtectionHealth +from ._site_recovery_management_client_enums import RcmComponentStatus +from ._site_recovery_management_client_enums import RecoveryPlanActionLocation +from ._site_recovery_management_client_enums import RecoveryPlanGroupType +from ._site_recovery_management_client_enums import RecoveryPlanPointType +from ._site_recovery_management_client_enums import RecoveryPointSyncType +from ._site_recovery_management_client_enums import RecoveryPointType +from ._site_recovery_management_client_enums import ReplicationProtectedItemOperation +from ._site_recovery_management_client_enums import ResyncState +from ._site_recovery_management_client_enums import RpInMageRecoveryPointType +from ._site_recovery_management_client_enums import SetMultiVmSyncStatus +from ._site_recovery_management_client_enums import Severity +from ._site_recovery_management_client_enums import SourceSiteOperations +from ._site_recovery_management_client_enums import SqlServerLicenseType +from ._site_recovery_management_client_enums import TestMigrationState +from ._site_recovery_management_client_enums import VmEncryptionType +from ._site_recovery_management_client_enums import VmReplicationProgressHealth +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'A2AAddDisksInput', - 'A2AApplyRecoveryPointInput', - 'A2AContainerCreationInput', - 'A2AContainerMappingInput', - 'A2ACreateProtectionIntentInput', - 'A2ACrossClusterMigrationApplyRecoveryPointInput', - 'A2ACrossClusterMigrationContainerCreationInput', - 'A2ACrossClusterMigrationEnableProtectionInput', - 'A2ACrossClusterMigrationPolicyCreationInput', - 'A2ACrossClusterMigrationReplicationDetails', - 'A2AEnableProtectionInput', - 'A2AEventDetails', - 'A2APolicyCreationInput', - 'A2APolicyDetails', - 'A2AProtectedDiskDetails', - 'A2AProtectedManagedDiskDetails', - 'A2AProtectionContainerMappingDetails', - 'A2AProtectionIntentDiskInputDetails', - 'A2AProtectionIntentManagedDiskInputDetails', - 'A2ARecoveryPointDetails', - 'A2ARemoveDisksInput', - 'A2AReplicationDetails', - 'A2AReplicationIntentDetails', - 'A2AReprotectInput', - 'A2ASwitchProtectionInput', - 'A2ATestFailoverInput', - 'A2AUnplannedFailoverInput', - 'A2AUnprotectedDiskDetails', - 'A2AUpdateContainerMappingInput', - 'A2AUpdateReplicationProtectedItemInput', - 'A2AVmDiskInputDetails', - 'A2AVmManagedDiskInputDetails', - 'A2AVmManagedDiskUpdateDetails', - 'A2AZoneDetails', - 'ASRTask', - 'AddDisksInput', - 'AddDisksInputProperties', - 'AddDisksProviderSpecificInput', - 'AddRecoveryServicesProviderInput', - 'AddRecoveryServicesProviderInputProperties', - 'AddVCenterRequest', - 'AddVCenterRequestProperties', - 'AgentDetails', - 'AgentDiskDetails', - 'Alert', - 'AlertCollection', - 'AlertProperties', - 'ApplyRecoveryPointInput', - 'ApplyRecoveryPointInputProperties', - 'ApplyRecoveryPointProviderSpecificInput', - 'AsrJobDetails', - 'AutomationRunbookTaskDetails', - 'AzureFabricCreationInput', - 'AzureFabricSpecificDetails', - 'AzureToAzureCreateNetworkMappingInput', - 'AzureToAzureNetworkMappingSettings', - 'AzureToAzureUpdateNetworkMappingInput', - 'AzureToAzureVmSyncedConfigDetails', - 'AzureVmDiskDetails', - 'ComputeSizeErrorDetails', - 'ConfigurationSettings', - 'ConfigureAlertRequest', - 'ConfigureAlertRequestProperties', - 'ConsistencyCheckTaskDetails', - 'CreateNetworkMappingInput', - 'CreateNetworkMappingInputProperties', - 'CreatePolicyInput', - 'CreatePolicyInputProperties', - 'CreateProtectionContainerInput', - 'CreateProtectionContainerInputProperties', - 'CreateProtectionContainerMappingInput', - 'CreateProtectionContainerMappingInputProperties', - 'CreateProtectionIntentInput', - 'CreateProtectionIntentProperties', - 'CreateProtectionIntentProviderSpecificDetails', - 'CreateRecoveryPlanInput', - 'CreateRecoveryPlanInputProperties', - 'CurrentJobDetails', - 'CurrentScenarioDetails', - 'DataStore', - 'DisableProtectionInput', - 'DisableProtectionInputProperties', - 'DisableProtectionProviderSpecificInput', - 'DiscoverProtectableItemRequest', - 'DiscoverProtectableItemRequestProperties', - 'DiskDetails', - 'DiskEncryptionInfo', - 'DiskEncryptionKeyInfo', - 'DiskVolumeDetails', - 'Display', - 'DraDetails', - 'EnableMigrationInput', - 'EnableMigrationInputProperties', - 'EnableMigrationProviderSpecificInput', - 'EnableProtectionInput', - 'EnableProtectionInputProperties', - 'EnableProtectionProviderSpecificInput', - 'EncryptionDetails', - 'Event', - 'EventCollection', - 'EventProperties', - 'EventProviderSpecificDetails', - 'EventQueryParameter', - 'EventSpecificDetails', - 'ExistingProtectionProfile', - 'ExistingRecoveryAvailabilitySet', - 'ExistingRecoveryProximityPlacementGroup', - 'ExistingRecoveryResourceGroup', - 'ExistingRecoveryVirtualNetwork', - 'ExistingStorageAccount', - 'ExportJobDetails', - 'Fabric', - 'FabricCollection', - 'FabricCreationInput', - 'FabricCreationInputProperties', - 'FabricProperties', - 'FabricQueryParameter', - 'FabricReplicationGroupTaskDetails', - 'FabricSpecificCreateNetworkMappingInput', - 'FabricSpecificCreationInput', - 'FabricSpecificDetails', - 'FabricSpecificUpdateNetworkMappingInput', - 'FailoverJobDetails', - 'FailoverProcessServerRequest', - 'FailoverProcessServerRequestProperties', - 'FailoverReplicationProtectedItemDetails', - 'GroupTaskDetails', - 'HealthError', - 'HealthErrorSummary', - 'HyperVHostDetails', - 'HyperVReplica2012EventDetails', - 'HyperVReplica2012R2EventDetails', - 'HyperVReplicaAzureApplyRecoveryPointInput', - 'HyperVReplicaAzureDiskInputDetails', - 'HyperVReplicaAzureEnableProtectionInput', - 'HyperVReplicaAzureEventDetails', - 'HyperVReplicaAzureFailbackProviderInput', - 'HyperVReplicaAzureManagedDiskDetails', - 'HyperVReplicaAzurePlannedFailoverProviderInput', - 'HyperVReplicaAzurePolicyDetails', - 'HyperVReplicaAzurePolicyInput', - 'HyperVReplicaAzureReplicationDetails', - 'HyperVReplicaAzureReprotectInput', - 'HyperVReplicaAzureTestFailoverInput', - 'HyperVReplicaAzureUnplannedFailoverInput', - 'HyperVReplicaAzureUpdateReplicationProtectedItemInput', - 'HyperVReplicaBaseEventDetails', - 'HyperVReplicaBasePolicyDetails', - 'HyperVReplicaBaseReplicationDetails', - 'HyperVReplicaBluePolicyDetails', - 'HyperVReplicaBluePolicyInput', - 'HyperVReplicaBlueReplicationDetails', - 'HyperVReplicaPolicyDetails', - 'HyperVReplicaPolicyInput', - 'HyperVReplicaReplicationDetails', - 'HyperVSiteDetails', - 'HyperVVirtualMachineDetails', - 'IPConfigDetails', - 'IPConfigInputDetails', - 'IdentityProviderDetails', - 'IdentityProviderInput', - 'InMageAgentDetails', - 'InMageAzureV2ApplyRecoveryPointInput', - 'InMageAzureV2DiskInputDetails', - 'InMageAzureV2EnableProtectionInput', - 'InMageAzureV2EventDetails', - 'InMageAzureV2ManagedDiskDetails', - 'InMageAzureV2PolicyDetails', - 'InMageAzureV2PolicyInput', - 'InMageAzureV2ProtectedDiskDetails', - 'InMageAzureV2RecoveryPointDetails', - 'InMageAzureV2ReplicationDetails', - 'InMageAzureV2ReprotectInput', - 'InMageAzureV2TestFailoverInput', - 'InMageAzureV2UnplannedFailoverInput', - 'InMageAzureV2UpdateReplicationProtectedItemInput', - 'InMageBasePolicyDetails', - 'InMageDisableProtectionProviderSpecificInput', - 'InMageDiskDetails', - 'InMageDiskExclusionInput', - 'InMageDiskSignatureExclusionOptions', - 'InMageEnableProtectionInput', - 'InMagePolicyDetails', - 'InMagePolicyInput', - 'InMageProtectedDiskDetails', - 'InMageRcmAgentUpgradeBlockingErrorDetails', - 'InMageRcmApplyRecoveryPointInput', - 'InMageRcmDiscoveredProtectedVmDetails', - 'InMageRcmDiskInput', - 'InMageRcmDisksDefaultInput', - 'InMageRcmEnableProtectionInput', - 'InMageRcmEventDetails', - 'InMageRcmFabricCreationInput', - 'InMageRcmFabricSpecificDetails', - 'InMageRcmFailbackDiscoveredProtectedVmDetails', - 'InMageRcmFailbackEventDetails', - 'InMageRcmFailbackMobilityAgentDetails', - 'InMageRcmFailbackNicDetails', - 'InMageRcmFailbackPlannedFailoverProviderInput', - 'InMageRcmFailbackPolicyCreationInput', - 'InMageRcmFailbackPolicyDetails', - 'InMageRcmFailbackProtectedDiskDetails', - 'InMageRcmFailbackReplicationDetails', - 'InMageRcmFailbackReprotectInput', - 'InMageRcmFailbackSyncDetails', - 'InMageRcmLastAgentUpgradeErrorDetails', - 'InMageRcmMobilityAgentDetails', - 'InMageRcmNicDetails', - 'InMageRcmNicInput', - 'InMageRcmPolicyCreationInput', - 'InMageRcmPolicyDetails', - 'InMageRcmProtectedDiskDetails', - 'InMageRcmProtectionContainerMappingDetails', - 'InMageRcmRecoveryPointDetails', - 'InMageRcmReplicationDetails', - 'InMageRcmReprotectInput', - 'InMageRcmSyncDetails', - 'InMageRcmTestFailoverInput', - 'InMageRcmUnplannedFailoverInput', - 'InMageRcmUpdateApplianceForReplicationProtectedItemInput', - 'InMageRcmUpdateContainerMappingInput', - 'InMageRcmUpdateReplicationProtectedItemInput', - 'InMageReplicationDetails', - 'InMageReprotectInput', - 'InMageTestFailoverInput', - 'InMageUnplannedFailoverInput', - 'InMageVolumeExclusionOptions', - 'InconsistentVmDetails', - 'InitialReplicationDetails', - 'InlineWorkflowTaskDetails', - 'InnerHealthError', - 'InputEndpoint', - 'Job', - 'JobCollection', - 'JobDetails', - 'JobEntity', - 'JobErrorDetails', - 'JobProperties', - 'JobQueryParameter', - 'JobStatusEventDetails', - 'JobTaskDetails', - 'KeyEncryptionKeyInfo', - 'LogicalNetwork', - 'LogicalNetworkCollection', - 'LogicalNetworkProperties', - 'ManualActionTaskDetails', - 'MarsAgentDetails', - 'MasterTargetServer', - 'MigrateInput', - 'MigrateInputProperties', - 'MigrateProviderSpecificInput', - 'MigrationItem', - 'MigrationItemCollection', - 'MigrationItemProperties', - 'MigrationItemsQueryParameter', - 'MigrationProviderSpecificSettings', - 'MigrationRecoveryPoint', - 'MigrationRecoveryPointCollection', - 'MigrationRecoveryPointProperties', - 'MobilityServiceUpdate', - 'Network', - 'NetworkCollection', - 'NetworkMapping', - 'NetworkMappingCollection', - 'NetworkMappingFabricSpecificSettings', - 'NetworkMappingProperties', - 'NetworkProperties', - 'NewProtectionProfile', - 'NewRecoveryVirtualNetwork', - 'OSDetails', - 'OSDiskDetails', - 'OSVersionWrapper', - 'OperationsDiscovery', - 'OperationsDiscoveryCollection', - 'PlannedFailoverInput', - 'PlannedFailoverInputProperties', - 'PlannedFailoverProviderSpecificFailoverInput', - 'Policy', - 'PolicyCollection', - 'PolicyProperties', - 'PolicyProviderSpecificDetails', - 'PolicyProviderSpecificInput', - 'ProcessServer', - 'ProcessServerDetails', - 'ProtectableItem', - 'ProtectableItemCollection', - 'ProtectableItemProperties', - 'ProtectableItemQueryParameter', - 'ProtectedItemsQueryParameter', - 'ProtectionContainer', - 'ProtectionContainerCollection', - 'ProtectionContainerFabricSpecificDetails', - 'ProtectionContainerMapping', - 'ProtectionContainerMappingCollection', - 'ProtectionContainerMappingProperties', - 'ProtectionContainerMappingProviderSpecificDetails', - 'ProtectionContainerProperties', - 'ProtectionProfileCustomDetails', - 'ProviderError', - 'ProviderSpecificRecoveryPointDetails', - 'PushInstallerDetails', - 'RcmProxyDetails', - 'RecoveryAvailabilitySetCustomDetails', - 'RecoveryPlan', - 'RecoveryPlanA2ADetails', - 'RecoveryPlanA2AFailoverInput', - 'RecoveryPlanA2AInput', - 'RecoveryPlanAction', - 'RecoveryPlanActionDetails', - 'RecoveryPlanAutomationRunbookActionDetails', - 'RecoveryPlanCollection', - 'RecoveryPlanGroup', - 'RecoveryPlanGroupTaskDetails', - 'RecoveryPlanHyperVReplicaAzureFailbackInput', - 'RecoveryPlanHyperVReplicaAzureFailoverInput', - 'RecoveryPlanInMageAzureV2FailoverInput', - 'RecoveryPlanInMageFailoverInput', - 'RecoveryPlanInMageRcmFailbackFailoverInput', - 'RecoveryPlanInMageRcmFailoverInput', - 'RecoveryPlanManualActionDetails', - 'RecoveryPlanPlannedFailoverInput', - 'RecoveryPlanPlannedFailoverInputProperties', - 'RecoveryPlanProperties', - 'RecoveryPlanProtectedItem', - 'RecoveryPlanProviderSpecificDetails', - 'RecoveryPlanProviderSpecificFailoverInput', - 'RecoveryPlanProviderSpecificInput', - 'RecoveryPlanScriptActionDetails', - 'RecoveryPlanShutdownGroupTaskDetails', - 'RecoveryPlanTestFailoverCleanupInput', - 'RecoveryPlanTestFailoverCleanupInputProperties', - 'RecoveryPlanTestFailoverInput', - 'RecoveryPlanTestFailoverInputProperties', - 'RecoveryPlanUnplannedFailoverInput', - 'RecoveryPlanUnplannedFailoverInputProperties', - 'RecoveryPoint', - 'RecoveryPointCollection', - 'RecoveryPointProperties', - 'RecoveryProximityPlacementGroupCustomDetails', - 'RecoveryResourceGroupCustomDetails', - 'RecoveryServicesProvider', - 'RecoveryServicesProviderCollection', - 'RecoveryServicesProviderProperties', - 'RecoveryVirtualNetworkCustomDetails', - 'RemoveDisksInput', - 'RemoveDisksInputProperties', - 'RemoveDisksProviderSpecificInput', - 'RemoveProtectionContainerMappingInput', - 'RemoveProtectionContainerMappingInputProperties', - 'RenewCertificateInput', - 'RenewCertificateInputProperties', - 'ReplicationAgentDetails', - 'ReplicationEligibilityResults', - 'ReplicationEligibilityResultsCollection', - 'ReplicationEligibilityResultsErrorInfo', - 'ReplicationEligibilityResultsProperties', - 'ReplicationGroupDetails', - 'ReplicationProtectedItem', - 'ReplicationProtectedItemCollection', - 'ReplicationProtectedItemProperties', - 'ReplicationProtectionIntent', - 'ReplicationProtectionIntentCollection', - 'ReplicationProtectionIntentProperties', - 'ReplicationProtectionIntentProviderSpecificSettings', - 'ReplicationProviderContainerUnmappingInput', - 'ReplicationProviderSpecificContainerCreationInput', - 'ReplicationProviderSpecificContainerMappingInput', - 'ReplicationProviderSpecificSettings', - 'ReplicationProviderSpecificUpdateContainerMappingInput', - 'ReprotectAgentDetails', - 'ResolveHealthError', - 'ResolveHealthInput', - 'ResolveHealthInputProperties', - 'Resource', - 'ResourceHealthSummary', - 'ResumeJobParams', - 'ResumeJobParamsProperties', - 'ResyncInput', - 'ResyncInputProperties', - 'ResyncProviderSpecificInput', - 'RetentionVolume', - 'ReverseReplicationInput', - 'ReverseReplicationInputProperties', - 'ReverseReplicationProviderSpecificInput', - 'RoleAssignment', - 'RunAsAccount', - 'ScriptActionTaskDetails', - 'ServiceError', - 'StorageAccountCustomDetails', - 'StorageClassification', - 'StorageClassificationCollection', - 'StorageClassificationMapping', - 'StorageClassificationMappingCollection', - 'StorageClassificationMappingInput', - 'StorageClassificationMappingProperties', - 'StorageClassificationProperties', - 'StorageMappingInputProperties', - 'Subnet', - 'SupportedOSDetails', - 'SupportedOSProperties', - 'SupportedOSProperty', - 'SupportedOperatingSystems', - 'SwitchProtectionInput', - 'SwitchProtectionInputProperties', - 'SwitchProtectionJobDetails', - 'SwitchProtectionProviderSpecificInput', - 'TargetComputeSize', - 'TargetComputeSizeCollection', - 'TargetComputeSizeProperties', - 'TaskTypeDetails', - 'TestFailoverCleanupInput', - 'TestFailoverCleanupInputProperties', - 'TestFailoverInput', - 'TestFailoverInputProperties', - 'TestFailoverJobDetails', - 'TestFailoverProviderSpecificInput', - 'TestMigrateCleanupInput', - 'TestMigrateCleanupInputProperties', - 'TestMigrateInput', - 'TestMigrateInputProperties', - 'TestMigrateProviderSpecificInput', - 'UnplannedFailoverInput', - 'UnplannedFailoverInputProperties', - 'UnplannedFailoverProviderSpecificInput', - 'UpdateApplianceForReplicationProtectedItemInput', - 'UpdateApplianceForReplicationProtectedItemInputProperties', - 'UpdateApplianceForReplicationProtectedItemProviderSpecificInput', - 'UpdateDiskInput', - 'UpdateMigrationItemInput', - 'UpdateMigrationItemInputProperties', - 'UpdateMigrationItemProviderSpecificInput', - 'UpdateMobilityServiceRequest', - 'UpdateMobilityServiceRequestProperties', - 'UpdateNetworkMappingInput', - 'UpdateNetworkMappingInputProperties', - 'UpdatePolicyInput', - 'UpdatePolicyInputProperties', - 'UpdateProtectionContainerMappingInput', - 'UpdateProtectionContainerMappingInputProperties', - 'UpdateRecoveryPlanInput', - 'UpdateRecoveryPlanInputProperties', - 'UpdateReplicationProtectedItemInput', - 'UpdateReplicationProtectedItemInputProperties', - 'UpdateReplicationProtectedItemProviderInput', - 'UpdateVCenterRequest', - 'UpdateVCenterRequestProperties', - 'VCenter', - 'VCenterCollection', - 'VCenterProperties', - 'VMNicDetails', - 'VMNicInputDetails', - 'VMwareCbtContainerCreationInput', - 'VMwareCbtContainerMappingInput', - 'VMwareCbtDiskInput', - 'VMwareCbtEnableMigrationInput', - 'VMwareCbtEventDetails', - 'VMwareCbtMigrateInput', - 'VMwareCbtMigrationDetails', - 'VMwareCbtNicDetails', - 'VMwareCbtNicInput', - 'VMwareCbtPolicyCreationInput', - 'VMwareCbtProtectedDiskDetails', - 'VMwareCbtProtectionContainerMappingDetails', - 'VMwareCbtResyncInput', - 'VMwareCbtTestMigrateInput', - 'VMwareCbtUpdateDiskInput', - 'VMwareCbtUpdateMigrationItemInput', - 'VMwareDetails', - 'VMwareV2FabricCreationInput', - 'VMwareV2FabricSpecificDetails', - 'VMwareVirtualMachineDetails', - 'VaultHealthDetails', - 'VaultHealthProperties', - 'VaultSetting', - 'VaultSettingCollection', - 'VaultSettingCreationInput', - 'VaultSettingCreationInputProperties', - 'VaultSettingProperties', - 'VersionDetails', - 'VirtualMachineTaskDetails', - 'VmNicUpdatesTaskDetails', - 'VmmDetails', - 'VmmToAzureCreateNetworkMappingInput', - 'VmmToAzureNetworkMappingSettings', - 'VmmToAzureUpdateNetworkMappingInput', - 'VmmToVmmCreateNetworkMappingInput', - 'VmmToVmmNetworkMappingSettings', - 'VmmToVmmUpdateNetworkMappingInput', - 'VmmVirtualMachineDetails', - 'VmwareCbtPolicyDetails', - 'A2ARecoveryAvailabilityType', - 'A2ARpRecoveryPointType', - 'AgentAutoUpdateStatus', - 'AgentUpgradeBlockedReason', - 'AgentVersionStatus', - 'AlternateLocationRecoveryOption', - 'AutoProtectionOfDataDisk', - 'DataSyncStatus', - 'DisableProtectionReason', - 'DiskAccountType', - 'DiskReplicationProgressHealth', - 'EthernetAddressType', - 'ExportJobOutputSerializationType', - 'FailoverDeploymentModel', - 'HealthErrorCategory', - 'HealthErrorCustomerResolvability', - 'HyperVReplicaAzureRpRecoveryPointType', - 'InMageRcmFailbackRecoveryPointType', - 'InMageV2RpRecoveryPointType', - 'LicenseType', - 'MigrationItemOperation', - 'MigrationRecoveryPointType', - 'MigrationState', - 'MobilityAgentUpgradeState', - 'MultiVmGroupCreateOption', - 'MultiVmSyncPointOption', - 'PlannedFailoverStatus', - 'PossibleOperationsDirections', - 'PresenceStatus', - 'ProtectionHealth', - 'RcmComponentStatus', - 'RecoveryPlanActionLocation', - 'RecoveryPlanGroupType', - 'RecoveryPlanPointType', - 'RecoveryPointSyncType', - 'RecoveryPointType', - 'ReplicationProtectedItemOperation', - 'ResyncState', - 'RpInMageRecoveryPointType', - 'SetMultiVmSyncStatus', - 'Severity', - 'SourceSiteOperations', - 'SqlServerLicenseType', - 'TestMigrationState', - 'VmEncryptionType', - 'VmReplicationProgressHealth', + "A2AAddDisksInput", + "A2AApplyRecoveryPointInput", + "A2AContainerCreationInput", + "A2AContainerMappingInput", + "A2ACreateProtectionIntentInput", + "A2ACrossClusterMigrationApplyRecoveryPointInput", + "A2ACrossClusterMigrationContainerCreationInput", + "A2ACrossClusterMigrationEnableProtectionInput", + "A2ACrossClusterMigrationPolicyCreationInput", + "A2ACrossClusterMigrationReplicationDetails", + "A2AEnableProtectionInput", + "A2AEventDetails", + "A2APolicyCreationInput", + "A2APolicyDetails", + "A2AProtectedDiskDetails", + "A2AProtectedManagedDiskDetails", + "A2AProtectionContainerMappingDetails", + "A2AProtectionIntentDiskInputDetails", + "A2AProtectionIntentManagedDiskInputDetails", + "A2ARecoveryPointDetails", + "A2ARemoveDisksInput", + "A2AReplicationDetails", + "A2AReplicationIntentDetails", + "A2AReprotectInput", + "A2ASwitchProtectionInput", + "A2ATestFailoverInput", + "A2AUnplannedFailoverInput", + "A2AUnprotectedDiskDetails", + "A2AUpdateContainerMappingInput", + "A2AUpdateReplicationProtectedItemInput", + "A2AVmDiskInputDetails", + "A2AVmManagedDiskInputDetails", + "A2AVmManagedDiskUpdateDetails", + "A2AZoneDetails", + "ASRTask", + "AddDisksInput", + "AddDisksInputProperties", + "AddDisksProviderSpecificInput", + "AddRecoveryServicesProviderInput", + "AddRecoveryServicesProviderInputProperties", + "AddVCenterRequest", + "AddVCenterRequestProperties", + "AgentDetails", + "AgentDiskDetails", + "Alert", + "AlertCollection", + "AlertProperties", + "ApplianceCollection", + "ApplianceQueryParameter", + "ApplianceSpecificDetails", + "ApplyRecoveryPointInput", + "ApplyRecoveryPointInputProperties", + "ApplyRecoveryPointProviderSpecificInput", + "AsrJobDetails", + "AutomationRunbookTaskDetails", + "AzureFabricCreationInput", + "AzureFabricSpecificDetails", + "AzureToAzureCreateNetworkMappingInput", + "AzureToAzureNetworkMappingSettings", + "AzureToAzureUpdateNetworkMappingInput", + "AzureToAzureVmSyncedConfigDetails", + "AzureVmDiskDetails", + "ComputeSizeErrorDetails", + "ConfigurationSettings", + "ConfigureAlertRequest", + "ConfigureAlertRequestProperties", + "ConsistencyCheckTaskDetails", + "CreateNetworkMappingInput", + "CreateNetworkMappingInputProperties", + "CreatePolicyInput", + "CreatePolicyInputProperties", + "CreateProtectionContainerInput", + "CreateProtectionContainerInputProperties", + "CreateProtectionContainerMappingInput", + "CreateProtectionContainerMappingInputProperties", + "CreateProtectionIntentInput", + "CreateProtectionIntentProperties", + "CreateProtectionIntentProviderSpecificDetails", + "CreateRecoveryPlanInput", + "CreateRecoveryPlanInputProperties", + "CriticalJobHistoryDetails", + "CurrentJobDetails", + "CurrentScenarioDetails", + "DataStore", + "DisableProtectionInput", + "DisableProtectionInputProperties", + "DisableProtectionProviderSpecificInput", + "DiscoverProtectableItemRequest", + "DiscoverProtectableItemRequestProperties", + "DiskDetails", + "DiskEncryptionInfo", + "DiskEncryptionKeyInfo", + "DiskVolumeDetails", + "Display", + "DraDetails", + "EnableMigrationInput", + "EnableMigrationInputProperties", + "EnableMigrationProviderSpecificInput", + "EnableProtectionInput", + "EnableProtectionInputProperties", + "EnableProtectionProviderSpecificInput", + "EncryptionDetails", + "Event", + "EventCollection", + "EventProperties", + "EventProviderSpecificDetails", + "EventQueryParameter", + "EventSpecificDetails", + "ExistingProtectionProfile", + "ExistingRecoveryAvailabilitySet", + "ExistingRecoveryProximityPlacementGroup", + "ExistingRecoveryResourceGroup", + "ExistingRecoveryVirtualNetwork", + "ExistingStorageAccount", + "ExportJobDetails", + "ExtendedLocation", + "Fabric", + "FabricCollection", + "FabricCreationInput", + "FabricCreationInputProperties", + "FabricProperties", + "FabricQueryParameter", + "FabricReplicationGroupTaskDetails", + "FabricSpecificCreateNetworkMappingInput", + "FabricSpecificCreationInput", + "FabricSpecificDetails", + "FabricSpecificUpdateNetworkMappingInput", + "FailoverJobDetails", + "FailoverProcessServerRequest", + "FailoverProcessServerRequestProperties", + "FailoverReplicationProtectedItemDetails", + "GroupTaskDetails", + "HealthError", + "HealthErrorSummary", + "HyperVHostDetails", + "HyperVReplica2012EventDetails", + "HyperVReplica2012R2EventDetails", + "HyperVReplicaAzureApplyRecoveryPointInput", + "HyperVReplicaAzureDiskInputDetails", + "HyperVReplicaAzureEnableProtectionInput", + "HyperVReplicaAzureEventDetails", + "HyperVReplicaAzureFailbackProviderInput", + "HyperVReplicaAzureManagedDiskDetails", + "HyperVReplicaAzurePlannedFailoverProviderInput", + "HyperVReplicaAzurePolicyDetails", + "HyperVReplicaAzurePolicyInput", + "HyperVReplicaAzureReplicationDetails", + "HyperVReplicaAzureReprotectInput", + "HyperVReplicaAzureTestFailoverInput", + "HyperVReplicaAzureUnplannedFailoverInput", + "HyperVReplicaAzureUpdateReplicationProtectedItemInput", + "HyperVReplicaBaseEventDetails", + "HyperVReplicaBasePolicyDetails", + "HyperVReplicaBaseReplicationDetails", + "HyperVReplicaBluePolicyDetails", + "HyperVReplicaBluePolicyInput", + "HyperVReplicaBlueReplicationDetails", + "HyperVReplicaPolicyDetails", + "HyperVReplicaPolicyInput", + "HyperVReplicaReplicationDetails", + "HyperVSiteDetails", + "HyperVVirtualMachineDetails", + "IPConfigDetails", + "IPConfigInputDetails", + "IdentityProviderDetails", + "IdentityProviderInput", + "InMageAgentDetails", + "InMageAzureV2ApplyRecoveryPointInput", + "InMageAzureV2DiskInputDetails", + "InMageAzureV2EnableProtectionInput", + "InMageAzureV2EventDetails", + "InMageAzureV2ManagedDiskDetails", + "InMageAzureV2PolicyDetails", + "InMageAzureV2PolicyInput", + "InMageAzureV2ProtectedDiskDetails", + "InMageAzureV2RecoveryPointDetails", + "InMageAzureV2ReplicationDetails", + "InMageAzureV2ReprotectInput", + "InMageAzureV2SwitchProviderBlockingErrorDetails", + "InMageAzureV2SwitchProviderDetails", + "InMageAzureV2SwitchProviderInput", + "InMageAzureV2TestFailoverInput", + "InMageAzureV2UnplannedFailoverInput", + "InMageAzureV2UpdateReplicationProtectedItemInput", + "InMageBasePolicyDetails", + "InMageDisableProtectionProviderSpecificInput", + "InMageDiskDetails", + "InMageDiskExclusionInput", + "InMageDiskSignatureExclusionOptions", + "InMageEnableProtectionInput", + "InMageFabricSwitchProviderBlockingErrorDetails", + "InMagePolicyDetails", + "InMagePolicyInput", + "InMageProtectedDiskDetails", + "InMageRcmAgentUpgradeBlockingErrorDetails", + "InMageRcmApplianceDetails", + "InMageRcmApplianceSpecificDetails", + "InMageRcmApplyRecoveryPointInput", + "InMageRcmDiscoveredProtectedVmDetails", + "InMageRcmDiskInput", + "InMageRcmDisksDefaultInput", + "InMageRcmEnableProtectionInput", + "InMageRcmEventDetails", + "InMageRcmFabricCreationInput", + "InMageRcmFabricSpecificDetails", + "InMageRcmFabricSwitchProviderBlockingErrorDetails", + "InMageRcmFailbackDiscoveredProtectedVmDetails", + "InMageRcmFailbackEventDetails", + "InMageRcmFailbackMobilityAgentDetails", + "InMageRcmFailbackNicDetails", + "InMageRcmFailbackPlannedFailoverProviderInput", + "InMageRcmFailbackPolicyCreationInput", + "InMageRcmFailbackPolicyDetails", + "InMageRcmFailbackProtectedDiskDetails", + "InMageRcmFailbackReplicationDetails", + "InMageRcmFailbackReprotectInput", + "InMageRcmFailbackSyncDetails", + "InMageRcmLastAgentUpgradeErrorDetails", + "InMageRcmMobilityAgentDetails", + "InMageRcmNicDetails", + "InMageRcmNicInput", + "InMageRcmPolicyCreationInput", + "InMageRcmPolicyDetails", + "InMageRcmProtectedDiskDetails", + "InMageRcmProtectionContainerMappingDetails", + "InMageRcmRecoveryPointDetails", + "InMageRcmReplicationDetails", + "InMageRcmReprotectInput", + "InMageRcmSyncDetails", + "InMageRcmTestFailoverInput", + "InMageRcmUnplannedFailoverInput", + "InMageRcmUpdateApplianceForReplicationProtectedItemInput", + "InMageRcmUpdateContainerMappingInput", + "InMageRcmUpdateReplicationProtectedItemInput", + "InMageReplicationDetails", + "InMageReprotectInput", + "InMageTestFailoverInput", + "InMageUnplannedFailoverInput", + "InMageVolumeExclusionOptions", + "InconsistentVmDetails", + "InitialReplicationDetails", + "InlineWorkflowTaskDetails", + "InnerHealthError", + "InputEndpoint", + "Job", + "JobCollection", + "JobDetails", + "JobEntity", + "JobErrorDetails", + "JobProperties", + "JobQueryParameter", + "JobStatusEventDetails", + "JobTaskDetails", + "KeyEncryptionKeyInfo", + "LogicalNetwork", + "LogicalNetworkCollection", + "LogicalNetworkProperties", + "ManualActionTaskDetails", + "MarsAgentDetails", + "MasterTargetServer", + "MigrateInput", + "MigrateInputProperties", + "MigrateProviderSpecificInput", + "MigrationItem", + "MigrationItemCollection", + "MigrationItemProperties", + "MigrationItemsQueryParameter", + "MigrationProviderSpecificSettings", + "MigrationRecoveryPoint", + "MigrationRecoveryPointCollection", + "MigrationRecoveryPointProperties", + "MobilityServiceUpdate", + "Network", + "NetworkCollection", + "NetworkMapping", + "NetworkMappingCollection", + "NetworkMappingFabricSpecificSettings", + "NetworkMappingProperties", + "NetworkProperties", + "NewProtectionProfile", + "NewRecoveryVirtualNetwork", + "OSDetails", + "OSDiskDetails", + "OSVersionWrapper", + "OperationsDiscovery", + "OperationsDiscoveryCollection", + "PauseReplicationInput", + "PauseReplicationInputProperties", + "PlannedFailoverInput", + "PlannedFailoverInputProperties", + "PlannedFailoverProviderSpecificFailoverInput", + "Policy", + "PolicyCollection", + "PolicyProperties", + "PolicyProviderSpecificDetails", + "PolicyProviderSpecificInput", + "ProcessServer", + "ProcessServerDetails", + "ProtectableItem", + "ProtectableItemCollection", + "ProtectableItemProperties", + "ProtectableItemQueryParameter", + "ProtectedItemsQueryParameter", + "ProtectionContainer", + "ProtectionContainerCollection", + "ProtectionContainerFabricSpecificDetails", + "ProtectionContainerMapping", + "ProtectionContainerMappingCollection", + "ProtectionContainerMappingProperties", + "ProtectionContainerMappingProviderSpecificDetails", + "ProtectionContainerProperties", + "ProtectionProfileCustomDetails", + "ProviderError", + "ProviderSpecificRecoveryPointDetails", + "PushInstallerDetails", + "RcmProxyDetails", + "RecoveryAvailabilitySetCustomDetails", + "RecoveryPlan", + "RecoveryPlanA2ADetails", + "RecoveryPlanA2AFailoverInput", + "RecoveryPlanA2AInput", + "RecoveryPlanAction", + "RecoveryPlanActionDetails", + "RecoveryPlanAutomationRunbookActionDetails", + "RecoveryPlanCollection", + "RecoveryPlanGroup", + "RecoveryPlanGroupTaskDetails", + "RecoveryPlanHyperVReplicaAzureFailbackInput", + "RecoveryPlanHyperVReplicaAzureFailoverInput", + "RecoveryPlanInMageAzureV2FailoverInput", + "RecoveryPlanInMageFailoverInput", + "RecoveryPlanInMageRcmFailbackFailoverInput", + "RecoveryPlanInMageRcmFailoverInput", + "RecoveryPlanManualActionDetails", + "RecoveryPlanPlannedFailoverInput", + "RecoveryPlanPlannedFailoverInputProperties", + "RecoveryPlanProperties", + "RecoveryPlanProtectedItem", + "RecoveryPlanProviderSpecificDetails", + "RecoveryPlanProviderSpecificFailoverInput", + "RecoveryPlanProviderSpecificInput", + "RecoveryPlanScriptActionDetails", + "RecoveryPlanShutdownGroupTaskDetails", + "RecoveryPlanTestFailoverCleanupInput", + "RecoveryPlanTestFailoverCleanupInputProperties", + "RecoveryPlanTestFailoverInput", + "RecoveryPlanTestFailoverInputProperties", + "RecoveryPlanUnplannedFailoverInput", + "RecoveryPlanUnplannedFailoverInputProperties", + "RecoveryPoint", + "RecoveryPointCollection", + "RecoveryPointProperties", + "RecoveryProximityPlacementGroupCustomDetails", + "RecoveryResourceGroupCustomDetails", + "RecoveryServicesProvider", + "RecoveryServicesProviderCollection", + "RecoveryServicesProviderProperties", + "RecoveryVirtualNetworkCustomDetails", + "RemoveDisksInput", + "RemoveDisksInputProperties", + "RemoveDisksProviderSpecificInput", + "RemoveProtectionContainerMappingInput", + "RemoveProtectionContainerMappingInputProperties", + "RenewCertificateInput", + "RenewCertificateInputProperties", + "ReplicationAgentDetails", + "ReplicationAppliance", + "ReplicationApplianceProperties", + "ReplicationEligibilityResults", + "ReplicationEligibilityResultsCollection", + "ReplicationEligibilityResultsErrorInfo", + "ReplicationEligibilityResultsProperties", + "ReplicationGroupDetails", + "ReplicationProtectedItem", + "ReplicationProtectedItemCollection", + "ReplicationProtectedItemProperties", + "ReplicationProtectionIntent", + "ReplicationProtectionIntentCollection", + "ReplicationProtectionIntentProperties", + "ReplicationProtectionIntentProviderSpecificSettings", + "ReplicationProviderContainerUnmappingInput", + "ReplicationProviderSpecificContainerCreationInput", + "ReplicationProviderSpecificContainerMappingInput", + "ReplicationProviderSpecificSettings", + "ReplicationProviderSpecificUpdateContainerMappingInput", + "ReprotectAgentDetails", + "ResolveHealthError", + "ResolveHealthInput", + "ResolveHealthInputProperties", + "Resource", + "ResourceHealthSummary", + "ResumeJobParams", + "ResumeJobParamsProperties", + "ResumeReplicationInput", + "ResumeReplicationInputProperties", + "ResumeReplicationProviderSpecificInput", + "ResyncInput", + "ResyncInputProperties", + "ResyncProviderSpecificInput", + "RetentionVolume", + "ReverseReplicationInput", + "ReverseReplicationInputProperties", + "ReverseReplicationProviderSpecificInput", + "RoleAssignment", + "RunAsAccount", + "ScriptActionTaskDetails", + "ServiceError", + "StorageAccountCustomDetails", + "StorageClassification", + "StorageClassificationCollection", + "StorageClassificationMapping", + "StorageClassificationMappingCollection", + "StorageClassificationMappingInput", + "StorageClassificationMappingProperties", + "StorageClassificationProperties", + "StorageMappingInputProperties", + "Subnet", + "SupportedOSDetails", + "SupportedOSProperties", + "SupportedOSProperty", + "SupportedOperatingSystems", + "SwitchProtectionInput", + "SwitchProtectionInputProperties", + "SwitchProtectionJobDetails", + "SwitchProtectionProviderSpecificInput", + "SwitchProviderInput", + "SwitchProviderInputProperties", + "SwitchProviderSpecificInput", + "TargetComputeSize", + "TargetComputeSizeCollection", + "TargetComputeSizeProperties", + "TaskTypeDetails", + "TestFailoverCleanupInput", + "TestFailoverCleanupInputProperties", + "TestFailoverInput", + "TestFailoverInputProperties", + "TestFailoverJobDetails", + "TestFailoverProviderSpecificInput", + "TestMigrateCleanupInput", + "TestMigrateCleanupInputProperties", + "TestMigrateInput", + "TestMigrateInputProperties", + "TestMigrateProviderSpecificInput", + "UnplannedFailoverInput", + "UnplannedFailoverInputProperties", + "UnplannedFailoverProviderSpecificInput", + "UpdateApplianceForReplicationProtectedItemInput", + "UpdateApplianceForReplicationProtectedItemInputProperties", + "UpdateApplianceForReplicationProtectedItemProviderSpecificInput", + "UpdateDiskInput", + "UpdateMigrationItemInput", + "UpdateMigrationItemInputProperties", + "UpdateMigrationItemProviderSpecificInput", + "UpdateMobilityServiceRequest", + "UpdateMobilityServiceRequestProperties", + "UpdateNetworkMappingInput", + "UpdateNetworkMappingInputProperties", + "UpdatePolicyInput", + "UpdatePolicyInputProperties", + "UpdateProtectionContainerMappingInput", + "UpdateProtectionContainerMappingInputProperties", + "UpdateRecoveryPlanInput", + "UpdateRecoveryPlanInputProperties", + "UpdateReplicationProtectedItemInput", + "UpdateReplicationProtectedItemInputProperties", + "UpdateReplicationProtectedItemProviderInput", + "UpdateVCenterRequest", + "UpdateVCenterRequestProperties", + "VCenter", + "VCenterCollection", + "VCenterProperties", + "VMNicDetails", + "VMNicInputDetails", + "VMwareCbtContainerCreationInput", + "VMwareCbtContainerMappingInput", + "VMwareCbtDiskInput", + "VMwareCbtEnableMigrationInput", + "VMwareCbtEventDetails", + "VMwareCbtMigrateInput", + "VMwareCbtMigrationDetails", + "VMwareCbtNicDetails", + "VMwareCbtNicInput", + "VMwareCbtPolicyCreationInput", + "VMwareCbtProtectedDiskDetails", + "VMwareCbtProtectionContainerMappingDetails", + "VMwareCbtResumeReplicationInput", + "VMwareCbtResyncInput", + "VMwareCbtTestMigrateInput", + "VMwareCbtUpdateDiskInput", + "VMwareCbtUpdateMigrationItemInput", + "VMwareDetails", + "VMwareV2FabricCreationInput", + "VMwareV2FabricSpecificDetails", + "VMwareVirtualMachineDetails", + "VaultHealthDetails", + "VaultHealthProperties", + "VaultSetting", + "VaultSettingCollection", + "VaultSettingCreationInput", + "VaultSettingCreationInputProperties", + "VaultSettingProperties", + "VersionDetails", + "VirtualMachineTaskDetails", + "VmNicUpdatesTaskDetails", + "VmmDetails", + "VmmToAzureCreateNetworkMappingInput", + "VmmToAzureNetworkMappingSettings", + "VmmToAzureUpdateNetworkMappingInput", + "VmmToVmmCreateNetworkMappingInput", + "VmmToVmmNetworkMappingSettings", + "VmmToVmmUpdateNetworkMappingInput", + "VmmVirtualMachineDetails", + "VmwareCbtPolicyDetails", + "A2ARecoveryAvailabilityType", + "A2ARpRecoveryPointType", + "AgentAutoUpdateStatus", + "AgentUpgradeBlockedReason", + "AgentVersionStatus", + "AlternateLocationRecoveryOption", + "AutoProtectionOfDataDisk", + "AutomationAccountAuthenticationType", + "DataSyncStatus", + "DisableProtectionReason", + "DiskAccountType", + "DiskReplicationProgressHealth", + "EthernetAddressType", + "ExportJobOutputSerializationType", + "ExtendedLocationType", + "FailoverDeploymentModel", + "HealthErrorCategory", + "HealthErrorCustomerResolvability", + "HyperVReplicaAzureRpRecoveryPointType", + "InMageRcmFailbackRecoveryPointType", + "InMageV2RpRecoveryPointType", + "LicenseType", + "MigrationItemOperation", + "MigrationRecoveryPointType", + "MigrationState", + "MobilityAgentUpgradeState", + "MultiVmGroupCreateOption", + "MultiVmSyncPointOption", + "PlannedFailoverStatus", + "PossibleOperationsDirections", + "PresenceStatus", + "ProtectionHealth", + "RcmComponentStatus", + "RecoveryPlanActionLocation", + "RecoveryPlanGroupType", + "RecoveryPlanPointType", + "RecoveryPointSyncType", + "RecoveryPointType", + "ReplicationProtectedItemOperation", + "ResyncState", + "RpInMageRecoveryPointType", + "SetMultiVmSyncStatus", + "Severity", + "SourceSiteOperations", + "SqlServerLicenseType", + "TestMigrationState", + "VmEncryptionType", + "VmReplicationProgressHealth", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models.py deleted file mode 100644 index a67702ce31bd..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models.py +++ /dev/null @@ -1,20801 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AddDisksProviderSpecificInput(msrest.serialization.Model): - """Add Disks provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AAddDisksInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AAddDisksInput'} - } - - def __init__( - self, - **kwargs - ): - super(AddDisksProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AAddDisksInput(AddDisksProviderSpecificInput): - """A2A add disk(s) input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param vm_disks: The list of vm disk details. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk details. - :type vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AVmDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AVmManagedDiskInputDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AAddDisksInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.vm_disks = kwargs.get('vm_disks', None) - self.vm_managed_disks = kwargs.get('vm_managed_disks', None) - - -class ApplyRecoveryPointProviderSpecificInput(msrest.serialization.Model): - """Provider specific input for apply recovery point. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AApplyRecoveryPointInput, A2ACrossClusterMigrationApplyRecoveryPointInput, HyperVReplicaAzureApplyRecoveryPointInput, InMageAzureV2ApplyRecoveryPointInput, InMageRcmApplyRecoveryPointInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AApplyRecoveryPointInput', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationApplyRecoveryPointInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureApplyRecoveryPointInput', 'InMageAzureV2': 'InMageAzureV2ApplyRecoveryPointInput', 'InMageRcm': 'InMageRcmApplyRecoveryPointInput'} - } - - def __init__( - self, - **kwargs - ): - super(ApplyRecoveryPointProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): - """ApplyRecoveryPoint input specific to A2A provider. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - - -class ReplicationProviderSpecificContainerCreationInput(msrest.serialization.Model): - """Provider specific input for container creation operation. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AContainerCreationInput, A2ACrossClusterMigrationContainerCreationInput, VMwareCbtContainerCreationInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AContainerCreationInput', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationContainerCreationInput', 'VMwareCbt': 'VMwareCbtContainerCreationInput'} - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProviderSpecificContainerCreationInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AContainerCreationInput(ReplicationProviderSpecificContainerCreationInput): - """A2A cloud creation input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AContainerCreationInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - - -class ReplicationProviderSpecificContainerMappingInput(msrest.serialization.Model): - """Provider specific input for pairing operations. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AContainerMappingInput, VMwareCbtContainerMappingInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AContainerMappingInput', 'VMwareCbt': 'VMwareCbtContainerMappingInput'} - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProviderSpecificContainerMappingInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AContainerMappingInput(ReplicationProviderSpecificContainerMappingInput): - """A2A container mapping input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param agent_auto_update_status: A value indicating whether the auto update is enabled. - Possible values include: "Disabled", "Enabled". - :type agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :param automation_account_arm_id: The automation account arm id. - :type automation_account_arm_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'agent_auto_update_status': {'key': 'agentAutoUpdateStatus', 'type': 'str'}, - 'automation_account_arm_id': {'key': 'automationAccountArmId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AContainerMappingInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.agent_auto_update_status = kwargs.get('agent_auto_update_status', None) - self.automation_account_arm_id = kwargs.get('automation_account_arm_id', None) - - -class CreateProtectionIntentProviderSpecificDetails(msrest.serialization.Model): - """Create protection intent provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ACreateProtectionIntentInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2ACreateProtectionIntentInput'} - } - - def __init__( - self, - **kwargs - ): - super(CreateProtectionIntentProviderSpecificDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2ACreateProtectionIntentInput(CreateProtectionIntentProviderSpecificDetails): - """A2A create protection intent input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: Required. The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param primary_location: Required. The primary location for the virtual machine. - :type primary_location: str - :param recovery_location: Required. The recovery location for the virtual machine. - :type recovery_location: str - :param recovery_subscription_id: Required. The recovery subscription Id of the virtual machine. - :type recovery_subscription_id: str - :param recovery_availability_type: Required. The recovery availability type of the virtual - machine. Possible values include: "Single", "AvailabilitySet", "AvailabilityZone". - :type recovery_availability_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.A2ARecoveryAvailabilityType - :param protection_profile_custom_input: The protection profile custom inputs. - :type protection_profile_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails - :param recovery_resource_group_id: Required. The recovery resource group Id. Valid for V2 - scenarios. - :type recovery_resource_group_id: str - :param primary_staging_storage_account_custom_input: The primary staging storage account input. - :type primary_staging_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param recovery_availability_set_custom_input: The recovery availability set input. - :type recovery_availability_set_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails - :param recovery_virtual_network_custom_input: The recovery virtual network input. - :type recovery_virtual_network_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails - :param recovery_proximity_placement_group_custom_input: The recovery proximity placement group - custom input. - :type recovery_proximity_placement_group_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails - :param auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Possible values include: "Disabled", "Enabled". - :type auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :param vm_disks: The list of vm disk inputs. - :type vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk inputs. - :type vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_group_id: The multi vm group id. - :type multi_vm_group_id: str - :param recovery_boot_diag_storage_account: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param disk_encryption_info: The recovery disk encryption information (for two pass flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'fabric_object_id': {'required': True}, - 'primary_location': {'required': True}, - 'recovery_location': {'required': True}, - 'recovery_subscription_id': {'required': True}, - 'recovery_availability_type': {'required': True}, - 'recovery_resource_group_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'primary_location': {'key': 'primaryLocation', 'type': 'str'}, - 'recovery_location': {'key': 'recoveryLocation', 'type': 'str'}, - 'recovery_subscription_id': {'key': 'recoverySubscriptionId', 'type': 'str'}, - 'recovery_availability_type': {'key': 'recoveryAvailabilityType', 'type': 'str'}, - 'protection_profile_custom_input': {'key': 'protectionProfileCustomInput', 'type': 'ProtectionProfileCustomDetails'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'primary_staging_storage_account_custom_input': {'key': 'primaryStagingStorageAccountCustomInput', 'type': 'StorageAccountCustomDetails'}, - 'recovery_availability_set_custom_input': {'key': 'recoveryAvailabilitySetCustomInput', 'type': 'RecoveryAvailabilitySetCustomDetails'}, - 'recovery_virtual_network_custom_input': {'key': 'recoveryVirtualNetworkCustomInput', 'type': 'RecoveryVirtualNetworkCustomDetails'}, - 'recovery_proximity_placement_group_custom_input': {'key': 'recoveryProximityPlacementGroupCustomInput', 'type': 'RecoveryProximityPlacementGroupCustomDetails'}, - 'auto_protection_of_data_disk': {'key': 'autoProtectionOfDataDisk', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AProtectionIntentDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AProtectionIntentManagedDiskInputDetails]'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'recovery_boot_diag_storage_account': {'key': 'recoveryBootDiagStorageAccount', 'type': 'StorageAccountCustomDetails'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ACreateProtectionIntentInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.fabric_object_id = kwargs['fabric_object_id'] - self.primary_location = kwargs['primary_location'] - self.recovery_location = kwargs['recovery_location'] - self.recovery_subscription_id = kwargs['recovery_subscription_id'] - self.recovery_availability_type = kwargs['recovery_availability_type'] - self.protection_profile_custom_input = kwargs.get('protection_profile_custom_input', None) - self.recovery_resource_group_id = kwargs['recovery_resource_group_id'] - self.primary_staging_storage_account_custom_input = kwargs.get('primary_staging_storage_account_custom_input', None) - self.recovery_availability_set_custom_input = kwargs.get('recovery_availability_set_custom_input', None) - self.recovery_virtual_network_custom_input = kwargs.get('recovery_virtual_network_custom_input', None) - self.recovery_proximity_placement_group_custom_input = kwargs.get('recovery_proximity_placement_group_custom_input', None) - self.auto_protection_of_data_disk = kwargs.get('auto_protection_of_data_disk', None) - self.vm_disks = kwargs.get('vm_disks', None) - self.vm_managed_disks = kwargs.get('vm_managed_disks', None) - self.multi_vm_group_name = kwargs.get('multi_vm_group_name', None) - self.multi_vm_group_id = kwargs.get('multi_vm_group_id', None) - self.recovery_boot_diag_storage_account = kwargs.get('recovery_boot_diag_storage_account', None) - self.disk_encryption_info = kwargs.get('disk_encryption_info', None) - self.recovery_availability_zone = kwargs.get('recovery_availability_zone', None) - - -class A2ACrossClusterMigrationApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): - """ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ACrossClusterMigrationApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str - - -class A2ACrossClusterMigrationContainerCreationInput(ReplicationProviderSpecificContainerCreationInput): - """A2ACrossClusterMigration cloud creation input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ACrossClusterMigrationContainerCreationInput, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str - - -class EnableProtectionProviderSpecificInput(msrest.serialization.Model): - """Enable protection provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AEnableProtectionInput, A2ACrossClusterMigrationEnableProtectionInput, HyperVReplicaAzureEnableProtectionInput, InMageEnableProtectionInput, InMageAzureV2EnableProtectionInput, InMageRcmEnableProtectionInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AEnableProtectionInput', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationEnableProtectionInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureEnableProtectionInput', 'InMage': 'InMageEnableProtectionInput', 'InMageAzureV2': 'InMageAzureV2EnableProtectionInput', 'InMageRcm': 'InMageRcmEnableProtectionInput'} - } - - def __init__( - self, - **kwargs - ): - super(EnableProtectionProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2ACrossClusterMigrationEnableProtectionInput(EnableProtectionProviderSpecificInput): - """A2A Cross-Cluster Migration enable protection input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ACrossClusterMigrationEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str - self.fabric_object_id = kwargs.get('fabric_object_id', None) - self.recovery_container_id = kwargs.get('recovery_container_id', None) - - -class PolicyProviderSpecificInput(msrest.serialization.Model): - """Base class for provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2APolicyCreationInput, A2ACrossClusterMigrationPolicyCreationInput, HyperVReplicaPolicyInput, HyperVReplicaAzurePolicyInput, InMagePolicyInput, InMageAzureV2PolicyInput, InMageRcmPolicyCreationInput, InMageRcmFailbackPolicyCreationInput, VMwareCbtPolicyCreationInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2APolicyCreationInput', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationPolicyCreationInput', 'HyperVReplica2012': 'HyperVReplicaPolicyInput', 'HyperVReplicaAzure': 'HyperVReplicaAzurePolicyInput', 'InMage': 'InMagePolicyInput', 'InMageAzureV2': 'InMageAzureV2PolicyInput', 'InMageRcm': 'InMageRcmPolicyCreationInput', 'InMageRcmFailback': 'InMageRcmFailbackPolicyCreationInput', 'VMwareCbt': 'VMwareCbtPolicyCreationInput'} - } - - def __init__( - self, - **kwargs - ): - super(PolicyProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2ACrossClusterMigrationPolicyCreationInput(PolicyProviderSpecificInput): - """A2A Cross-Cluster Migration Policy creation input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ACrossClusterMigrationPolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str - - -class ReplicationProviderSpecificSettings(msrest.serialization.Model): - """Replication provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AReplicationDetails, A2ACrossClusterMigrationReplicationDetails, HyperVReplicaReplicationDetails, HyperVReplicaBlueReplicationDetails, HyperVReplicaAzureReplicationDetails, HyperVReplicaBaseReplicationDetails, InMageReplicationDetails, InMageAzureV2ReplicationDetails, InMageRcmReplicationDetails, InMageRcmFailbackReplicationDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AReplicationDetails', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationReplicationDetails', 'HyperVReplica2012': 'HyperVReplicaReplicationDetails', 'HyperVReplica2012R2': 'HyperVReplicaBlueReplicationDetails', 'HyperVReplicaAzure': 'HyperVReplicaAzureReplicationDetails', 'HyperVReplicaBaseReplicationDetails': 'HyperVReplicaBaseReplicationDetails', 'InMage': 'InMageReplicationDetails', 'InMageAzureV2': 'InMageAzureV2ReplicationDetails', 'InMageRcm': 'InMageRcmReplicationDetails', 'InMageRcmFailback': 'InMageRcmFailbackReplicationDetails'} - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProviderSpecificSettings, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2ACrossClusterMigrationReplicationDetails(ReplicationProviderSpecificSettings): - """A2A provider specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param primary_fabric_location: Primary fabric location. - :type primary_fabric_location: str - :param os_type: The type of operating system. - :type os_type: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param lifecycle_id: An id associated with the PE that survives actions like switch protection - which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to - have a link/continuity in being able to have an Id that denotes the "same" protected item even - though other internal Ids/ARM Id might be changing. - :type lifecycle_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'primary_fabric_location': {'key': 'primaryFabricLocation', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'lifecycle_id': {'key': 'lifecycleId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ACrossClusterMigrationReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str - self.fabric_object_id = kwargs.get('fabric_object_id', None) - self.primary_fabric_location = kwargs.get('primary_fabric_location', None) - self.os_type = kwargs.get('os_type', None) - self.vm_protection_state = kwargs.get('vm_protection_state', None) - self.vm_protection_state_description = kwargs.get('vm_protection_state_description', None) - self.lifecycle_id = kwargs.get('lifecycle_id', None) - - -class A2AEnableProtectionInput(EnableProtectionProviderSpecificInput): - """A2A enable protection input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: Required. The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str - :param recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :type recovery_resource_group_id: str - :param recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :type recovery_cloud_service_id: str - :param recovery_availability_set_id: The recovery availability set Id. - :type recovery_availability_set_id: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :type recovery_proximity_placement_group_id: str - :param vm_disks: The list of vm disk details. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk details. - :type vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_group_id: The multi vm group id. - :type multi_vm_group_id: str - :param recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account_id: str - :param disk_encryption_info: The recovery disk encryption information (for two pass flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - :param recovery_azure_network_id: The recovery Azure virtual network ARM id. - :type recovery_azure_network_id: str - :param recovery_subnet_name: The recovery subnet name. - :type recovery_subnet_name: str - :param recovery_virtual_machine_scale_set_id: The virtual machine scale set Id. - :type recovery_virtual_machine_scale_set_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'fabric_object_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_cloud_service_id': {'key': 'recoveryCloudServiceId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AVmDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AVmManagedDiskInputDetails]'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'recovery_boot_diag_storage_account_id': {'key': 'recoveryBootDiagStorageAccountId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, - 'recovery_azure_network_id': {'key': 'recoveryAzureNetworkId', 'type': 'str'}, - 'recovery_subnet_name': {'key': 'recoverySubnetName', 'type': 'str'}, - 'recovery_virtual_machine_scale_set_id': {'key': 'recoveryVirtualMachineScaleSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.fabric_object_id = kwargs['fabric_object_id'] - self.recovery_container_id = kwargs.get('recovery_container_id', None) - self.recovery_resource_group_id = kwargs.get('recovery_resource_group_id', None) - self.recovery_cloud_service_id = kwargs.get('recovery_cloud_service_id', None) - self.recovery_availability_set_id = kwargs.get('recovery_availability_set_id', None) - self.recovery_proximity_placement_group_id = kwargs.get('recovery_proximity_placement_group_id', None) - self.vm_disks = kwargs.get('vm_disks', None) - self.vm_managed_disks = kwargs.get('vm_managed_disks', None) - self.multi_vm_group_name = kwargs.get('multi_vm_group_name', None) - self.multi_vm_group_id = kwargs.get('multi_vm_group_id', None) - self.recovery_boot_diag_storage_account_id = kwargs.get('recovery_boot_diag_storage_account_id', None) - self.disk_encryption_info = kwargs.get('disk_encryption_info', None) - self.recovery_availability_zone = kwargs.get('recovery_availability_zone', None) - self.recovery_azure_network_id = kwargs.get('recovery_azure_network_id', None) - self.recovery_subnet_name = kwargs.get('recovery_subnet_name', None) - self.recovery_virtual_machine_scale_set_id = kwargs.get('recovery_virtual_machine_scale_set_id', None) - - -class EventProviderSpecificDetails(msrest.serialization.Model): - """Model class for provider specific details for an event. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AEventDetails, HyperVReplica2012EventDetails, HyperVReplica2012R2EventDetails, HyperVReplicaAzureEventDetails, HyperVReplicaBaseEventDetails, InMageAzureV2EventDetails, InMageRcmEventDetails, InMageRcmFailbackEventDetails, VMwareCbtEventDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AEventDetails', 'HyperVReplica2012': 'HyperVReplica2012EventDetails', 'HyperVReplica2012R2': 'HyperVReplica2012R2EventDetails', 'HyperVReplicaAzure': 'HyperVReplicaAzureEventDetails', 'HyperVReplicaBaseEventDetails': 'HyperVReplicaBaseEventDetails', 'InMageAzureV2': 'InMageAzureV2EventDetails', 'InMageRcm': 'InMageRcmEventDetails', 'InMageRcmFailback': 'InMageRcmFailbackEventDetails', 'VMwareCbt': 'VMwareCbtEventDetails'} - } - - def __init__( - self, - **kwargs - ): - super(EventProviderSpecificDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AEventDetails(EventProviderSpecificDetails): - """Model class for event details of a A2A event. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param protected_item_name: The protected item arm name. - :type protected_item_name: str - :param fabric_object_id: The azure vm arm id. - :type fabric_object_id: str - :param fabric_name: Fabric arm name. - :type fabric_name: str - :param fabric_location: The fabric location. - :type fabric_location: str - :param remote_fabric_name: Remote fabric arm name. - :type remote_fabric_name: str - :param remote_fabric_location: Remote fabric location. - :type remote_fabric_location: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'protected_item_name': {'key': 'protectedItemName', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'fabric_location': {'key': 'fabricLocation', 'type': 'str'}, - 'remote_fabric_name': {'key': 'remoteFabricName', 'type': 'str'}, - 'remote_fabric_location': {'key': 'remoteFabricLocation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AEventDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.protected_item_name = kwargs.get('protected_item_name', None) - self.fabric_object_id = kwargs.get('fabric_object_id', None) - self.fabric_name = kwargs.get('fabric_name', None) - self.fabric_location = kwargs.get('fabric_location', None) - self.remote_fabric_name = kwargs.get('remote_fabric_name', None) - self.remote_fabric_location = kwargs.get('remote_fabric_location', None) - - -class A2APolicyCreationInput(PolicyProviderSpecificInput): - """A2A Policy creation input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :type recovery_point_history: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: Required. A value indicating whether multi-VM sync has to be - enabled. Value should be 'Enabled' or 'Disabled'. Possible values include: "Enable", "Disable". - :type multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - - _validation = { - 'instance_type': {'required': True}, - 'multi_vm_sync_status': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2APolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.recovery_point_history = kwargs.get('recovery_point_history', None) - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.multi_vm_sync_status = kwargs['multi_vm_sync_status'] - - -class PolicyProviderSpecificDetails(msrest.serialization.Model): - """Base class for Provider specific details for policies. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2APolicyDetails, HyperVReplicaPolicyDetails, HyperVReplicaBluePolicyDetails, HyperVReplicaAzurePolicyDetails, HyperVReplicaBasePolicyDetails, InMagePolicyDetails, InMageAzureV2PolicyDetails, InMageBasePolicyDetails, InMageRcmPolicyDetails, InMageRcmFailbackPolicyDetails, VmwareCbtPolicyDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2APolicyDetails', 'HyperVReplica2012': 'HyperVReplicaPolicyDetails', 'HyperVReplica2012R2': 'HyperVReplicaBluePolicyDetails', 'HyperVReplicaAzure': 'HyperVReplicaAzurePolicyDetails', 'HyperVReplicaBasePolicyDetails': 'HyperVReplicaBasePolicyDetails', 'InMage': 'InMagePolicyDetails', 'InMageAzureV2': 'InMageAzureV2PolicyDetails', 'InMageBasePolicyDetails': 'InMageBasePolicyDetails', 'InMageRcm': 'InMageRcmPolicyDetails', 'InMageRcmFailback': 'InMageRcmFailbackPolicyDetails', 'VMwareCbt': 'VmwareCbtPolicyDetails'} - } - - def __init__( - self, - **kwargs - ): - super(PolicyProviderSpecificDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2APolicyDetails(PolicyProviderSpecificDetails): - """A2A specific policy details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :type multi_vm_sync_status: str - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :type crash_consistent_frequency_in_minutes: int - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(A2APolicyDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.recovery_point_threshold_in_minutes = kwargs.get('recovery_point_threshold_in_minutes', None) - self.recovery_point_history = kwargs.get('recovery_point_history', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.multi_vm_sync_status = kwargs.get('multi_vm_sync_status', None) - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - - -class A2AProtectedDiskDetails(msrest.serialization.Model): - """A2A protected disk details. - - :param disk_uri: The disk uri. - :type disk_uri: str - :param recovery_azure_storage_account_id: The recovery disk storage account. - :type recovery_azure_storage_account_id: str - :param primary_disk_azure_storage_account_id: The primary disk storage account. - :type primary_disk_azure_storage_account_id: str - :param recovery_disk_uri: Recovery disk uri. - :type recovery_disk_uri: str - :param disk_name: The disk name. - :type disk_name: str - :param disk_capacity_in_bytes: The disk capacity in bytes. - :type disk_capacity_in_bytes: long - :param primary_staging_azure_storage_account_id: The primary staging storage account. - :type primary_staging_azure_storage_account_id: str - :param disk_type: The type of disk. - :type disk_type: str - :param resync_required: A value indicating whether resync is required for this disk. - :type resync_required: bool - :param monitoring_percentage_completion: The percentage of the monitoring job. The type of the - monitoring job is defined by MonitoringJobType property. - :type monitoring_percentage_completion: int - :param monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :type monitoring_job_type: str - :param data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at - staging account. - :type data_pending_in_staging_storage_account_in_mb: float - :param data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. - :type data_pending_at_source_agent_in_mb: float - :param disk_state: The disk state. - :type disk_state: str - :param allowed_disk_level_operation: The disk level operations list. - :type allowed_disk_level_operation: list[str] - :param is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. - :type is_disk_encrypted: bool - :param secret_identifier: The secret URL / identifier (BEK). - :type secret_identifier: str - :param dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). - :type dek_key_vault_arm_id: str - :param is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. - :type is_disk_key_encrypted: bool - :param key_identifier: The key URL / identifier (KEK). - :type key_identifier: str - :param kek_key_vault_arm_id: The KeyVault resource id for key (KEK). - :type kek_key_vault_arm_id: str - :param failover_disk_name: The failover name for the managed disk. - :type failover_disk_name: str - :param tfo_disk_name: The test failover name for the managed disk. - :type tfo_disk_name: str - """ - - _attribute_map = { - 'disk_uri': {'key': 'diskUri', 'type': 'str'}, - 'recovery_azure_storage_account_id': {'key': 'recoveryAzureStorageAccountId', 'type': 'str'}, - 'primary_disk_azure_storage_account_id': {'key': 'primaryDiskAzureStorageAccountId', 'type': 'str'}, - 'recovery_disk_uri': {'key': 'recoveryDiskUri', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'disk_capacity_in_bytes': {'key': 'diskCapacityInBytes', 'type': 'long'}, - 'primary_staging_azure_storage_account_id': {'key': 'primaryStagingAzureStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'bool'}, - 'monitoring_percentage_completion': {'key': 'monitoringPercentageCompletion', 'type': 'int'}, - 'monitoring_job_type': {'key': 'monitoringJobType', 'type': 'str'}, - 'data_pending_in_staging_storage_account_in_mb': {'key': 'dataPendingInStagingStorageAccountInMB', 'type': 'float'}, - 'data_pending_at_source_agent_in_mb': {'key': 'dataPendingAtSourceAgentInMB', 'type': 'float'}, - 'disk_state': {'key': 'diskState', 'type': 'str'}, - 'allowed_disk_level_operation': {'key': 'allowedDiskLevelOperation', 'type': '[str]'}, - 'is_disk_encrypted': {'key': 'isDiskEncrypted', 'type': 'bool'}, - 'secret_identifier': {'key': 'secretIdentifier', 'type': 'str'}, - 'dek_key_vault_arm_id': {'key': 'dekKeyVaultArmId', 'type': 'str'}, - 'is_disk_key_encrypted': {'key': 'isDiskKeyEncrypted', 'type': 'bool'}, - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'kek_key_vault_arm_id': {'key': 'kekKeyVaultArmId', 'type': 'str'}, - 'failover_disk_name': {'key': 'failoverDiskName', 'type': 'str'}, - 'tfo_disk_name': {'key': 'tfoDiskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AProtectedDiskDetails, self).__init__(**kwargs) - self.disk_uri = kwargs.get('disk_uri', None) - self.recovery_azure_storage_account_id = kwargs.get('recovery_azure_storage_account_id', None) - self.primary_disk_azure_storage_account_id = kwargs.get('primary_disk_azure_storage_account_id', None) - self.recovery_disk_uri = kwargs.get('recovery_disk_uri', None) - self.disk_name = kwargs.get('disk_name', None) - self.disk_capacity_in_bytes = kwargs.get('disk_capacity_in_bytes', None) - self.primary_staging_azure_storage_account_id = kwargs.get('primary_staging_azure_storage_account_id', None) - self.disk_type = kwargs.get('disk_type', None) - self.resync_required = kwargs.get('resync_required', None) - self.monitoring_percentage_completion = kwargs.get('monitoring_percentage_completion', None) - self.monitoring_job_type = kwargs.get('monitoring_job_type', None) - self.data_pending_in_staging_storage_account_in_mb = kwargs.get('data_pending_in_staging_storage_account_in_mb', None) - self.data_pending_at_source_agent_in_mb = kwargs.get('data_pending_at_source_agent_in_mb', None) - self.disk_state = kwargs.get('disk_state', None) - self.allowed_disk_level_operation = kwargs.get('allowed_disk_level_operation', None) - self.is_disk_encrypted = kwargs.get('is_disk_encrypted', None) - self.secret_identifier = kwargs.get('secret_identifier', None) - self.dek_key_vault_arm_id = kwargs.get('dek_key_vault_arm_id', None) - self.is_disk_key_encrypted = kwargs.get('is_disk_key_encrypted', None) - self.key_identifier = kwargs.get('key_identifier', None) - self.kek_key_vault_arm_id = kwargs.get('kek_key_vault_arm_id', None) - self.failover_disk_name = kwargs.get('failover_disk_name', None) - self.tfo_disk_name = kwargs.get('tfo_disk_name', None) - - -class A2AProtectedManagedDiskDetails(msrest.serialization.Model): - """A2A protected managed disk details. - - :param disk_id: The managed disk Arm id. - :type disk_id: str - :param recovery_resource_group_id: The recovery disk resource group Arm Id. - :type recovery_resource_group_id: str - :param recovery_target_disk_id: Recovery target disk Arm Id. - :type recovery_target_disk_id: str - :param recovery_replica_disk_id: Recovery replica disk Arm Id. - :type recovery_replica_disk_id: str - :param recovery_orignal_target_disk_id: Recovery original target disk Arm Id. - :type recovery_orignal_target_disk_id: str - :param recovery_replica_disk_account_type: The replica disk type. Its an optional value and - will be same as source disk type if not user provided. - :type recovery_replica_disk_account_type: str - :param recovery_target_disk_account_type: The target disk type after failover. Its an optional - value and will be same as source disk type if not user provided. - :type recovery_target_disk_account_type: str - :param recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :type recovery_disk_encryption_set_id: str - :param primary_disk_encryption_set_id: The primary disk encryption set Id. - :type primary_disk_encryption_set_id: str - :param disk_name: The disk name. - :type disk_name: str - :param disk_capacity_in_bytes: The disk capacity in bytes. - :type disk_capacity_in_bytes: long - :param primary_staging_azure_storage_account_id: The primary staging storage account. - :type primary_staging_azure_storage_account_id: str - :param disk_type: The type of disk. - :type disk_type: str - :param resync_required: A value indicating whether resync is required for this disk. - :type resync_required: bool - :param monitoring_percentage_completion: The percentage of the monitoring job. The type of the - monitoring job is defined by MonitoringJobType property. - :type monitoring_percentage_completion: int - :param monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :type monitoring_job_type: str - :param data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at - staging account. - :type data_pending_in_staging_storage_account_in_mb: float - :param data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. - :type data_pending_at_source_agent_in_mb: float - :param disk_state: The disk state. - :type disk_state: str - :param allowed_disk_level_operation: The disk level operations list. - :type allowed_disk_level_operation: list[str] - :param is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. - :type is_disk_encrypted: bool - :param secret_identifier: The secret URL / identifier (BEK). - :type secret_identifier: str - :param dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). - :type dek_key_vault_arm_id: str - :param is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. - :type is_disk_key_encrypted: bool - :param key_identifier: The key URL / identifier (KEK). - :type key_identifier: str - :param kek_key_vault_arm_id: The KeyVault resource id for key (KEK). - :type kek_key_vault_arm_id: str - :param failover_disk_name: The failover name for the managed disk. - :type failover_disk_name: str - :param tfo_disk_name: The test failover name for the managed disk. - :type tfo_disk_name: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_target_disk_id': {'key': 'recoveryTargetDiskId', 'type': 'str'}, - 'recovery_replica_disk_id': {'key': 'recoveryReplicaDiskId', 'type': 'str'}, - 'recovery_orignal_target_disk_id': {'key': 'recoveryOrignalTargetDiskId', 'type': 'str'}, - 'recovery_replica_disk_account_type': {'key': 'recoveryReplicaDiskAccountType', 'type': 'str'}, - 'recovery_target_disk_account_type': {'key': 'recoveryTargetDiskAccountType', 'type': 'str'}, - 'recovery_disk_encryption_set_id': {'key': 'recoveryDiskEncryptionSetId', 'type': 'str'}, - 'primary_disk_encryption_set_id': {'key': 'primaryDiskEncryptionSetId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'disk_capacity_in_bytes': {'key': 'diskCapacityInBytes', 'type': 'long'}, - 'primary_staging_azure_storage_account_id': {'key': 'primaryStagingAzureStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'bool'}, - 'monitoring_percentage_completion': {'key': 'monitoringPercentageCompletion', 'type': 'int'}, - 'monitoring_job_type': {'key': 'monitoringJobType', 'type': 'str'}, - 'data_pending_in_staging_storage_account_in_mb': {'key': 'dataPendingInStagingStorageAccountInMB', 'type': 'float'}, - 'data_pending_at_source_agent_in_mb': {'key': 'dataPendingAtSourceAgentInMB', 'type': 'float'}, - 'disk_state': {'key': 'diskState', 'type': 'str'}, - 'allowed_disk_level_operation': {'key': 'allowedDiskLevelOperation', 'type': '[str]'}, - 'is_disk_encrypted': {'key': 'isDiskEncrypted', 'type': 'bool'}, - 'secret_identifier': {'key': 'secretIdentifier', 'type': 'str'}, - 'dek_key_vault_arm_id': {'key': 'dekKeyVaultArmId', 'type': 'str'}, - 'is_disk_key_encrypted': {'key': 'isDiskKeyEncrypted', 'type': 'bool'}, - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'kek_key_vault_arm_id': {'key': 'kekKeyVaultArmId', 'type': 'str'}, - 'failover_disk_name': {'key': 'failoverDiskName', 'type': 'str'}, - 'tfo_disk_name': {'key': 'tfoDiskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AProtectedManagedDiskDetails, self).__init__(**kwargs) - self.disk_id = kwargs.get('disk_id', None) - self.recovery_resource_group_id = kwargs.get('recovery_resource_group_id', None) - self.recovery_target_disk_id = kwargs.get('recovery_target_disk_id', None) - self.recovery_replica_disk_id = kwargs.get('recovery_replica_disk_id', None) - self.recovery_orignal_target_disk_id = kwargs.get('recovery_orignal_target_disk_id', None) - self.recovery_replica_disk_account_type = kwargs.get('recovery_replica_disk_account_type', None) - self.recovery_target_disk_account_type = kwargs.get('recovery_target_disk_account_type', None) - self.recovery_disk_encryption_set_id = kwargs.get('recovery_disk_encryption_set_id', None) - self.primary_disk_encryption_set_id = kwargs.get('primary_disk_encryption_set_id', None) - self.disk_name = kwargs.get('disk_name', None) - self.disk_capacity_in_bytes = kwargs.get('disk_capacity_in_bytes', None) - self.primary_staging_azure_storage_account_id = kwargs.get('primary_staging_azure_storage_account_id', None) - self.disk_type = kwargs.get('disk_type', None) - self.resync_required = kwargs.get('resync_required', None) - self.monitoring_percentage_completion = kwargs.get('monitoring_percentage_completion', None) - self.monitoring_job_type = kwargs.get('monitoring_job_type', None) - self.data_pending_in_staging_storage_account_in_mb = kwargs.get('data_pending_in_staging_storage_account_in_mb', None) - self.data_pending_at_source_agent_in_mb = kwargs.get('data_pending_at_source_agent_in_mb', None) - self.disk_state = kwargs.get('disk_state', None) - self.allowed_disk_level_operation = kwargs.get('allowed_disk_level_operation', None) - self.is_disk_encrypted = kwargs.get('is_disk_encrypted', None) - self.secret_identifier = kwargs.get('secret_identifier', None) - self.dek_key_vault_arm_id = kwargs.get('dek_key_vault_arm_id', None) - self.is_disk_key_encrypted = kwargs.get('is_disk_key_encrypted', None) - self.key_identifier = kwargs.get('key_identifier', None) - self.kek_key_vault_arm_id = kwargs.get('kek_key_vault_arm_id', None) - self.failover_disk_name = kwargs.get('failover_disk_name', None) - self.tfo_disk_name = kwargs.get('tfo_disk_name', None) - - -class ProtectionContainerMappingProviderSpecificDetails(msrest.serialization.Model): - """Container mapping provider specific details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AProtectionContainerMappingDetails, InMageRcmProtectionContainerMappingDetails, VMwareCbtProtectionContainerMappingDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AProtectionContainerMappingDetails', 'InMageRcm': 'InMageRcmProtectionContainerMappingDetails', 'VMwareCbt': 'VMwareCbtProtectionContainerMappingDetails'} - } - - def __init__( - self, - **kwargs - ): - super(ProtectionContainerMappingProviderSpecificDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AProtectionContainerMappingDetails(ProtectionContainerMappingProviderSpecificDetails): - """A2A provider specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param agent_auto_update_status: A value indicating whether the auto update is enabled. - Possible values include: "Disabled", "Enabled". - :type agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :param automation_account_arm_id: The automation account arm id. - :type automation_account_arm_id: str - :param schedule_name: The schedule arm name. - :type schedule_name: str - :param job_schedule_name: The job schedule arm name. - :type job_schedule_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'agent_auto_update_status': {'key': 'agentAutoUpdateStatus', 'type': 'str'}, - 'automation_account_arm_id': {'key': 'automationAccountArmId', 'type': 'str'}, - 'schedule_name': {'key': 'scheduleName', 'type': 'str'}, - 'job_schedule_name': {'key': 'jobScheduleName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AProtectionContainerMappingDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.agent_auto_update_status = kwargs.get('agent_auto_update_status', None) - self.automation_account_arm_id = kwargs.get('automation_account_arm_id', None) - self.schedule_name = kwargs.get('schedule_name', None) - self.job_schedule_name = kwargs.get('job_schedule_name', None) - - -class A2AProtectionIntentDiskInputDetails(msrest.serialization.Model): - """Azure VM unmanaged disk input details. - - All required parameters must be populated in order to send to Azure. - - :param disk_uri: Required. The disk Uri. - :type disk_uri: str - :param recovery_azure_storage_account_custom_input: The recovery VHD storage account input. - :type recovery_azure_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param primary_staging_storage_account_custom_input: The primary staging storage account input. - :type primary_staging_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - """ - - _validation = { - 'disk_uri': {'required': True}, - } - - _attribute_map = { - 'disk_uri': {'key': 'diskUri', 'type': 'str'}, - 'recovery_azure_storage_account_custom_input': {'key': 'recoveryAzureStorageAccountCustomInput', 'type': 'StorageAccountCustomDetails'}, - 'primary_staging_storage_account_custom_input': {'key': 'primaryStagingStorageAccountCustomInput', 'type': 'StorageAccountCustomDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AProtectionIntentDiskInputDetails, self).__init__(**kwargs) - self.disk_uri = kwargs['disk_uri'] - self.recovery_azure_storage_account_custom_input = kwargs.get('recovery_azure_storage_account_custom_input', None) - self.primary_staging_storage_account_custom_input = kwargs.get('primary_staging_storage_account_custom_input', None) - - -class A2AProtectionIntentManagedDiskInputDetails(msrest.serialization.Model): - """Azure VM managed disk input details. - - All required parameters must be populated in order to send to Azure. - - :param disk_id: Required. The disk Id. - :type disk_id: str - :param primary_staging_storage_account_custom_input: The primary staging storage account input. - :type primary_staging_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param recovery_resource_group_custom_input: The recovery resource group input. - :type recovery_resource_group_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryResourceGroupCustomDetails - :param recovery_replica_disk_account_type: The replica disk type. Its an optional value and - will be same as source disk type if not user provided. - :type recovery_replica_disk_account_type: str - :param recovery_target_disk_account_type: The target disk type after failover. Its an optional - value and will be same as source disk type if not user provided. - :type recovery_target_disk_account_type: str - :param recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :type recovery_disk_encryption_set_id: str - :param disk_encryption_info: The recovery disk encryption information (for one / single pass - flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - - _validation = { - 'disk_id': {'required': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'primary_staging_storage_account_custom_input': {'key': 'primaryStagingStorageAccountCustomInput', 'type': 'StorageAccountCustomDetails'}, - 'recovery_resource_group_custom_input': {'key': 'recoveryResourceGroupCustomInput', 'type': 'RecoveryResourceGroupCustomDetails'}, - 'recovery_replica_disk_account_type': {'key': 'recoveryReplicaDiskAccountType', 'type': 'str'}, - 'recovery_target_disk_account_type': {'key': 'recoveryTargetDiskAccountType', 'type': 'str'}, - 'recovery_disk_encryption_set_id': {'key': 'recoveryDiskEncryptionSetId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AProtectionIntentManagedDiskInputDetails, self).__init__(**kwargs) - self.disk_id = kwargs['disk_id'] - self.primary_staging_storage_account_custom_input = kwargs.get('primary_staging_storage_account_custom_input', None) - self.recovery_resource_group_custom_input = kwargs.get('recovery_resource_group_custom_input', None) - self.recovery_replica_disk_account_type = kwargs.get('recovery_replica_disk_account_type', None) - self.recovery_target_disk_account_type = kwargs.get('recovery_target_disk_account_type', None) - self.recovery_disk_encryption_set_id = kwargs.get('recovery_disk_encryption_set_id', None) - self.disk_encryption_info = kwargs.get('disk_encryption_info', None) - - -class ProviderSpecificRecoveryPointDetails(msrest.serialization.Model): - """Replication provider specific recovery point details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ARecoveryPointDetails, InMageAzureV2RecoveryPointDetails, InMageRcmRecoveryPointDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the provider type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2ARecoveryPointDetails', 'InMageAzureV2': 'InMageAzureV2RecoveryPointDetails', 'InMageRcm': 'InMageRcmRecoveryPointDetails'} - } - - def __init__( - self, - **kwargs - ): - super(ProviderSpecificRecoveryPointDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2ARecoveryPointDetails(ProviderSpecificRecoveryPointDetails): - """A2A provider specific recovery point details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the provider type.Constant filled by server. - :type instance_type: str - :param recovery_point_sync_type: A value indicating whether the recovery point is multi VM - consistent. Possible values include: "MultiVmSyncRecoveryPoint", "PerVmRecoveryPoint". - :type recovery_point_sync_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType - :param disks: List of disk ids representing a recovery point. - :type disks: list[str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_sync_type': {'key': 'recoveryPointSyncType', 'type': 'str'}, - 'disks': {'key': 'disks', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ARecoveryPointDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.recovery_point_sync_type = kwargs.get('recovery_point_sync_type', None) - self.disks = kwargs.get('disks', None) - - -class RemoveDisksProviderSpecificInput(msrest.serialization.Model): - """Remove Disk provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ARemoveDisksInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2ARemoveDisksInput'} - } - - def __init__( - self, - **kwargs - ): - super(RemoveDisksProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2ARemoveDisksInput(RemoveDisksProviderSpecificInput): - """A2A remove disk(s) input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param vm_disks_uris: The list of vm disk vhd URIs. - :type vm_disks_uris: list[str] - :param vm_managed_disks_ids: The list of vm managed disk Ids. - :type vm_managed_disks_ids: list[str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_disks_uris': {'key': 'vmDisksUris', 'type': '[str]'}, - 'vm_managed_disks_ids': {'key': 'vmManagedDisksIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ARemoveDisksInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.vm_disks_uris = kwargs.get('vm_disks_uris', None) - self.vm_managed_disks_ids = kwargs.get('vm_managed_disks_ids', None) - - -class A2AReplicationDetails(ReplicationProviderSpecificSettings): - """A2A provider specific settings. - - 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. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :ivar initial_primary_zone: The initial primary availability zone. - :vartype initial_primary_zone: str - :ivar initial_primary_fabric_location: The initial primary fabric location. - :vartype initial_primary_fabric_location: str - :ivar initial_recovery_zone: The initial recovery availability zone. - :vartype initial_recovery_zone: str - :ivar initial_recovery_fabric_location: The initial recovery fabric location. - :vartype initial_recovery_fabric_location: str - :param multi_vm_group_id: The multi vm group Id. - :type multi_vm_group_id: str - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Possible values include: "AutoCreated", "UserSpecified". - :type multi_vm_group_create_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :param management_id: The management Id. - :type management_id: str - :param protected_disks: The list of protected disks. - :type protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedDiskDetails] - :param unprotected_disks: The list of unprotected disks. - :type unprotected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails] - :param protected_managed_disks: The list of protected managed disks. - :type protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails] - :param recovery_boot_diag_storage_account_id: The recovery boot diagnostic storage account Arm - Id. - :type recovery_boot_diag_storage_account_id: str - :param primary_fabric_location: Primary fabric location. - :type primary_fabric_location: str - :param recovery_fabric_location: The recovery fabric location. - :type recovery_fabric_location: str - :param os_type: The type of operating system. - :type os_type: str - :param recovery_azure_vm_size: The size of recovery virtual machine. - :type recovery_azure_vm_size: str - :param recovery_azure_vm_name: The name of recovery virtual machine. - :type recovery_azure_vm_name: str - :param recovery_azure_resource_group_id: The recovery resource group. - :type recovery_azure_resource_group_id: str - :param recovery_cloud_service: The recovery cloud service. - :type recovery_cloud_service: str - :param recovery_availability_set: The recovery availability set. - :type recovery_availability_set: str - :param selected_recovery_azure_network_id: The recovery virtual network. - :type selected_recovery_azure_network_id: str - :param selected_tfo_azure_network_id: The test failover virtual network. - :type selected_tfo_azure_network_id: str - :param vm_nics: The virtual machine nic details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param vm_synced_config_details: The synced configuration details. - :type vm_synced_config_details: - ~azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureVmSyncedConfigDetails - :param monitoring_percentage_completion: The percentage of the monitoring job. The type of the - monitoring job is defined by MonitoringJobType property. - :type monitoring_percentage_completion: int - :param monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :type monitoring_job_type: str - :param last_heartbeat: The last heartbeat received from the source server. - :type last_heartbeat: ~datetime.datetime - :param agent_version: The agent version. - :type agent_version: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param is_replication_agent_update_required: A value indicating whether replication agent - update is required. - :type is_replication_agent_update_required: bool - :ivar agent_certificate_expiry_date: Agent certificate expiry date. - :vartype agent_certificate_expiry_date: ~datetime.datetime - :param is_replication_agent_certificate_update_required: A value indicating whether agent - certificate update is required. - :type is_replication_agent_certificate_update_required: bool - :param recovery_fabric_object_id: The recovery fabric object Id. - :type recovery_fabric_object_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param lifecycle_id: An id associated with the PE that survives actions like switch protection - which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to - have a link/continuity in being able to have an Id that denotes the "same" protected item even - though other internal Ids/ARM Id might be changing. - :type lifecycle_id: str - :param test_failover_recovery_fabric_object_id: The test failover fabric object Id. - :type test_failover_recovery_fabric_object_id: str - :param rpo_in_seconds: The last RPO value in seconds. - :type rpo_in_seconds: long - :param last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by - Protection Service. - :type last_rpo_calculated_time: ~datetime.datetime - :param primary_availability_zone: The primary availability zone. - :type primary_availability_zone: str - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - :ivar vm_encryption_type: The encryption type of the VM. Possible values include: - "NotEncrypted", "OnePassEncrypted", "TwoPassEncrypted". - :vartype vm_encryption_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmEncryptionType - :param tfo_azure_vm_name: The test failover vm name. - :type tfo_azure_vm_name: str - :ivar recovery_azure_generation: The recovery azure generation. - :vartype recovery_azure_generation: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :type recovery_proximity_placement_group_id: str - :param auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Possible values include: "Disabled", "Enabled". - :type auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :param recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set id. - :type recovery_virtual_machine_scale_set_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'initial_primary_zone': {'readonly': True}, - 'initial_primary_fabric_location': {'readonly': True}, - 'initial_recovery_zone': {'readonly': True}, - 'initial_recovery_fabric_location': {'readonly': True}, - 'agent_certificate_expiry_date': {'readonly': True}, - 'vm_encryption_type': {'readonly': True}, - 'recovery_azure_generation': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'initial_primary_zone': {'key': 'initialPrimaryZone', 'type': 'str'}, - 'initial_primary_fabric_location': {'key': 'initialPrimaryFabricLocation', 'type': 'str'}, - 'initial_recovery_zone': {'key': 'initialRecoveryZone', 'type': 'str'}, - 'initial_recovery_fabric_location': {'key': 'initialRecoveryFabricLocation', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_group_create_option': {'key': 'multiVmGroupCreateOption', 'type': 'str'}, - 'management_id': {'key': 'managementId', 'type': 'str'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[A2AProtectedDiskDetails]'}, - 'unprotected_disks': {'key': 'unprotectedDisks', 'type': '[A2AUnprotectedDiskDetails]'}, - 'protected_managed_disks': {'key': 'protectedManagedDisks', 'type': '[A2AProtectedManagedDiskDetails]'}, - 'recovery_boot_diag_storage_account_id': {'key': 'recoveryBootDiagStorageAccountId', 'type': 'str'}, - 'primary_fabric_location': {'key': 'primaryFabricLocation', 'type': 'str'}, - 'recovery_fabric_location': {'key': 'recoveryFabricLocation', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'recovery_azure_vm_size': {'key': 'recoveryAzureVMSize', 'type': 'str'}, - 'recovery_azure_vm_name': {'key': 'recoveryAzureVMName', 'type': 'str'}, - 'recovery_azure_resource_group_id': {'key': 'recoveryAzureResourceGroupId', 'type': 'str'}, - 'recovery_cloud_service': {'key': 'recoveryCloudService', 'type': 'str'}, - 'recovery_availability_set': {'key': 'recoveryAvailabilitySet', 'type': 'str'}, - 'selected_recovery_azure_network_id': {'key': 'selectedRecoveryAzureNetworkId', 'type': 'str'}, - 'selected_tfo_azure_network_id': {'key': 'selectedTfoAzureNetworkId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'vm_synced_config_details': {'key': 'vmSyncedConfigDetails', 'type': 'AzureToAzureVmSyncedConfigDetails'}, - 'monitoring_percentage_completion': {'key': 'monitoringPercentageCompletion', 'type': 'int'}, - 'monitoring_job_type': {'key': 'monitoringJobType', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'is_replication_agent_update_required': {'key': 'isReplicationAgentUpdateRequired', 'type': 'bool'}, - 'agent_certificate_expiry_date': {'key': 'agentCertificateExpiryDate', 'type': 'iso-8601'}, - 'is_replication_agent_certificate_update_required': {'key': 'isReplicationAgentCertificateUpdateRequired', 'type': 'bool'}, - 'recovery_fabric_object_id': {'key': 'recoveryFabricObjectId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'lifecycle_id': {'key': 'lifecycleId', 'type': 'str'}, - 'test_failover_recovery_fabric_object_id': {'key': 'testFailoverRecoveryFabricObjectId', 'type': 'str'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'primary_availability_zone': {'key': 'primaryAvailabilityZone', 'type': 'str'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, - 'vm_encryption_type': {'key': 'vmEncryptionType', 'type': 'str'}, - 'tfo_azure_vm_name': {'key': 'tfoAzureVMName', 'type': 'str'}, - 'recovery_azure_generation': {'key': 'recoveryAzureGeneration', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, - 'auto_protection_of_data_disk': {'key': 'autoProtectionOfDataDisk', 'type': 'str'}, - 'recovery_virtual_machine_scale_set_id': {'key': 'recoveryVirtualMachineScaleSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.fabric_object_id = kwargs.get('fabric_object_id', None) - self.initial_primary_zone = None - self.initial_primary_fabric_location = None - self.initial_recovery_zone = None - self.initial_recovery_fabric_location = None - self.multi_vm_group_id = kwargs.get('multi_vm_group_id', None) - self.multi_vm_group_name = kwargs.get('multi_vm_group_name', None) - self.multi_vm_group_create_option = kwargs.get('multi_vm_group_create_option', None) - self.management_id = kwargs.get('management_id', None) - self.protected_disks = kwargs.get('protected_disks', None) - self.unprotected_disks = kwargs.get('unprotected_disks', None) - self.protected_managed_disks = kwargs.get('protected_managed_disks', None) - self.recovery_boot_diag_storage_account_id = kwargs.get('recovery_boot_diag_storage_account_id', None) - self.primary_fabric_location = kwargs.get('primary_fabric_location', None) - self.recovery_fabric_location = kwargs.get('recovery_fabric_location', None) - self.os_type = kwargs.get('os_type', None) - self.recovery_azure_vm_size = kwargs.get('recovery_azure_vm_size', None) - self.recovery_azure_vm_name = kwargs.get('recovery_azure_vm_name', None) - self.recovery_azure_resource_group_id = kwargs.get('recovery_azure_resource_group_id', None) - self.recovery_cloud_service = kwargs.get('recovery_cloud_service', None) - self.recovery_availability_set = kwargs.get('recovery_availability_set', None) - self.selected_recovery_azure_network_id = kwargs.get('selected_recovery_azure_network_id', None) - self.selected_tfo_azure_network_id = kwargs.get('selected_tfo_azure_network_id', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.vm_synced_config_details = kwargs.get('vm_synced_config_details', None) - self.monitoring_percentage_completion = kwargs.get('monitoring_percentage_completion', None) - self.monitoring_job_type = kwargs.get('monitoring_job_type', None) - self.last_heartbeat = kwargs.get('last_heartbeat', None) - self.agent_version = kwargs.get('agent_version', None) - self.agent_expiry_date = kwargs.get('agent_expiry_date', None) - self.is_replication_agent_update_required = kwargs.get('is_replication_agent_update_required', None) - self.agent_certificate_expiry_date = None - self.is_replication_agent_certificate_update_required = kwargs.get('is_replication_agent_certificate_update_required', None) - self.recovery_fabric_object_id = kwargs.get('recovery_fabric_object_id', None) - self.vm_protection_state = kwargs.get('vm_protection_state', None) - self.vm_protection_state_description = kwargs.get('vm_protection_state_description', None) - self.lifecycle_id = kwargs.get('lifecycle_id', None) - self.test_failover_recovery_fabric_object_id = kwargs.get('test_failover_recovery_fabric_object_id', None) - self.rpo_in_seconds = kwargs.get('rpo_in_seconds', None) - self.last_rpo_calculated_time = kwargs.get('last_rpo_calculated_time', None) - self.primary_availability_zone = kwargs.get('primary_availability_zone', None) - self.recovery_availability_zone = kwargs.get('recovery_availability_zone', None) - self.vm_encryption_type = None - self.tfo_azure_vm_name = kwargs.get('tfo_azure_vm_name', None) - self.recovery_azure_generation = None - self.recovery_proximity_placement_group_id = kwargs.get('recovery_proximity_placement_group_id', None) - self.auto_protection_of_data_disk = kwargs.get('auto_protection_of_data_disk', None) - self.recovery_virtual_machine_scale_set_id = kwargs.get('recovery_virtual_machine_scale_set_id', None) - - -class ReplicationProtectionIntentProviderSpecificSettings(msrest.serialization.Model): - """Replication provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AReplicationIntentDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AReplicationIntentDetails'} - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProtectionIntentProviderSpecificSettings, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AReplicationIntentDetails(ReplicationProtectionIntentProviderSpecificSettings): - """A2A provider specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param primary_location: The primary location for the virtual machine. - :type primary_location: str - :param recovery_location: The recovery location for the virtual machine. - :type recovery_location: str - :param recovery_subscription_id: The recovery subscription Id of the virtual machine. - :type recovery_subscription_id: str - :param vm_disks: The list of vm disk details. - :type vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk details. - :type vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] - :param recovery_resource_group_id: The recovery resource group id. - :type recovery_resource_group_id: str - :param protection_profile: The protection profile custom details. - :type protection_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails - :param primary_staging_storage_account: The primary staging storage account details. - :type primary_staging_storage_account: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param recovery_availability_set: The recovery availability set details. - :type recovery_availability_set: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails - :param recovery_virtual_network: The recovery virtual network details. - :type recovery_virtual_network: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails - :param recovery_proximity_placement_group: The recovery proximity placement group custom - details. - :type recovery_proximity_placement_group: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails - :param auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Possible values include: "Disabled", "Enabled". - :type auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_group_id: The multi vm group id. - :type multi_vm_group_id: str - :param recovery_boot_diag_storage_account: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param disk_encryption_info: The recovery disk encryption information (for two pass flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - :param recovery_availability_type: Required. The recovery availability type of the virtual - machine. - :type recovery_availability_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_availability_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'primary_location': {'key': 'primaryLocation', 'type': 'str'}, - 'recovery_location': {'key': 'recoveryLocation', 'type': 'str'}, - 'recovery_subscription_id': {'key': 'recoverySubscriptionId', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AProtectionIntentDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AProtectionIntentManagedDiskInputDetails]'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'protection_profile': {'key': 'protectionProfile', 'type': 'ProtectionProfileCustomDetails'}, - 'primary_staging_storage_account': {'key': 'primaryStagingStorageAccount', 'type': 'StorageAccountCustomDetails'}, - 'recovery_availability_set': {'key': 'recoveryAvailabilitySet', 'type': 'RecoveryAvailabilitySetCustomDetails'}, - 'recovery_virtual_network': {'key': 'recoveryVirtualNetwork', 'type': 'RecoveryVirtualNetworkCustomDetails'}, - 'recovery_proximity_placement_group': {'key': 'recoveryProximityPlacementGroup', 'type': 'RecoveryProximityPlacementGroupCustomDetails'}, - 'auto_protection_of_data_disk': {'key': 'autoProtectionOfDataDisk', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'recovery_boot_diag_storage_account': {'key': 'recoveryBootDiagStorageAccount', 'type': 'StorageAccountCustomDetails'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, - 'recovery_availability_type': {'key': 'recoveryAvailabilityType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AReplicationIntentDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.fabric_object_id = kwargs.get('fabric_object_id', None) - self.primary_location = kwargs.get('primary_location', None) - self.recovery_location = kwargs.get('recovery_location', None) - self.recovery_subscription_id = kwargs.get('recovery_subscription_id', None) - self.vm_disks = kwargs.get('vm_disks', None) - self.vm_managed_disks = kwargs.get('vm_managed_disks', None) - self.recovery_resource_group_id = kwargs.get('recovery_resource_group_id', None) - self.protection_profile = kwargs.get('protection_profile', None) - self.primary_staging_storage_account = kwargs.get('primary_staging_storage_account', None) - self.recovery_availability_set = kwargs.get('recovery_availability_set', None) - self.recovery_virtual_network = kwargs.get('recovery_virtual_network', None) - self.recovery_proximity_placement_group = kwargs.get('recovery_proximity_placement_group', None) - self.auto_protection_of_data_disk = kwargs.get('auto_protection_of_data_disk', None) - self.multi_vm_group_name = kwargs.get('multi_vm_group_name', None) - self.multi_vm_group_id = kwargs.get('multi_vm_group_id', None) - self.recovery_boot_diag_storage_account = kwargs.get('recovery_boot_diag_storage_account', None) - self.disk_encryption_info = kwargs.get('disk_encryption_info', None) - self.recovery_availability_zone = kwargs.get('recovery_availability_zone', None) - self.recovery_availability_type = kwargs['recovery_availability_type'] - - -class ReverseReplicationProviderSpecificInput(msrest.serialization.Model): - """Provider specific reverse replication input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AReprotectInput, HyperVReplicaAzureReprotectInput, InMageReprotectInput, InMageAzureV2ReprotectInput, InMageRcmReprotectInput, InMageRcmFailbackReprotectInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AReprotectInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureReprotectInput', 'InMage': 'InMageReprotectInput', 'InMageAzureV2': 'InMageAzureV2ReprotectInput', 'InMageRcm': 'InMageRcmReprotectInput', 'InMageRcmFailback': 'InMageRcmFailbackReprotectInput'} - } - - def __init__( - self, - **kwargs - ): - super(ReverseReplicationProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AReprotectInput(ReverseReplicationProviderSpecificInput): - """Azure specific reprotect input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str - :param vm_disks: The list of vm disk details. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :param recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :type recovery_resource_group_id: str - :param recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :type recovery_cloud_service_id: str - :param recovery_availability_set_id: The recovery availability set. - :type recovery_availability_set_id: str - :param policy_id: The Policy Id. - :type policy_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AVmDiskInputDetails]'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_cloud_service_id': {'key': 'recoveryCloudServiceId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AReprotectInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.recovery_container_id = kwargs.get('recovery_container_id', None) - self.vm_disks = kwargs.get('vm_disks', None) - self.recovery_resource_group_id = kwargs.get('recovery_resource_group_id', None) - self.recovery_cloud_service_id = kwargs.get('recovery_cloud_service_id', None) - self.recovery_availability_set_id = kwargs.get('recovery_availability_set_id', None) - self.policy_id = kwargs.get('policy_id', None) - - -class SwitchProtectionProviderSpecificInput(msrest.serialization.Model): - """Provider specific switch protection input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ASwitchProtectionInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2ASwitchProtectionInput'} - } - - def __init__( - self, - **kwargs - ): - super(SwitchProtectionProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2ASwitchProtectionInput(SwitchProtectionProviderSpecificInput): - """A2A specific switch protection input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str - :param vm_disks: The list of vm disk details. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk details. - :type vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :param recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :type recovery_resource_group_id: str - :param recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :type recovery_cloud_service_id: str - :param recovery_availability_set_id: The recovery availability set. - :type recovery_availability_set_id: str - :param policy_id: The Policy Id. - :type policy_id: str - :param recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account_id: str - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :type recovery_proximity_placement_group_id: str - :param recovery_virtual_machine_scale_set_id: The virtual machine scale set id. - :type recovery_virtual_machine_scale_set_id: str - :param disk_encryption_info: The recovery disk encryption information. - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AVmDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AVmManagedDiskInputDetails]'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_cloud_service_id': {'key': 'recoveryCloudServiceId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'recovery_boot_diag_storage_account_id': {'key': 'recoveryBootDiagStorageAccountId', 'type': 'str'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, - 'recovery_virtual_machine_scale_set_id': {'key': 'recoveryVirtualMachineScaleSetId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ASwitchProtectionInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.recovery_container_id = kwargs.get('recovery_container_id', None) - self.vm_disks = kwargs.get('vm_disks', None) - self.vm_managed_disks = kwargs.get('vm_managed_disks', None) - self.recovery_resource_group_id = kwargs.get('recovery_resource_group_id', None) - self.recovery_cloud_service_id = kwargs.get('recovery_cloud_service_id', None) - self.recovery_availability_set_id = kwargs.get('recovery_availability_set_id', None) - self.policy_id = kwargs.get('policy_id', None) - self.recovery_boot_diag_storage_account_id = kwargs.get('recovery_boot_diag_storage_account_id', None) - self.recovery_availability_zone = kwargs.get('recovery_availability_zone', None) - self.recovery_proximity_placement_group_id = kwargs.get('recovery_proximity_placement_group_id', None) - self.recovery_virtual_machine_scale_set_id = kwargs.get('recovery_virtual_machine_scale_set_id', None) - self.disk_encryption_info = kwargs.get('disk_encryption_info', None) - - -class TestFailoverProviderSpecificInput(msrest.serialization.Model): - """Provider specific test failover input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ATestFailoverInput, HyperVReplicaAzureTestFailoverInput, InMageTestFailoverInput, InMageAzureV2TestFailoverInput, InMageRcmTestFailoverInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2ATestFailoverInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureTestFailoverInput', 'InMage': 'InMageTestFailoverInput', 'InMageAzureV2': 'InMageAzureV2TestFailoverInput', 'InMageRcm': 'InMageRcmTestFailoverInput'} - } - - def __init__( - self, - **kwargs - ): - super(TestFailoverProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2ATestFailoverInput(TestFailoverProviderSpecificInput): - """A2A provider specific input for test failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - :param cloud_service_creation_option: A value indicating whether to use recovery cloud service - for TFO or not. - :type cloud_service_creation_option: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'cloud_service_creation_option': {'key': 'cloudServiceCreationOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2ATestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.recovery_point_id = kwargs.get('recovery_point_id', None) - self.cloud_service_creation_option = kwargs.get('cloud_service_creation_option', None) - - -class UnplannedFailoverProviderSpecificInput(msrest.serialization.Model): - """Provider specific unplanned failover input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AUnplannedFailoverInput, HyperVReplicaAzureUnplannedFailoverInput, InMageUnplannedFailoverInput, InMageAzureV2UnplannedFailoverInput, InMageRcmUnplannedFailoverInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AUnplannedFailoverInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureUnplannedFailoverInput', 'InMage': 'InMageUnplannedFailoverInput', 'InMageAzureV2': 'InMageAzureV2UnplannedFailoverInput', 'InMageRcm': 'InMageRcmUnplannedFailoverInput'} - } - - def __init__( - self, - **kwargs - ): - super(UnplannedFailoverProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """A2A provider specific input for unplanned failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - :param cloud_service_creation_option: A value indicating whether to use recovery cloud service - for failover or not. - :type cloud_service_creation_option: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'cloud_service_creation_option': {'key': 'cloudServiceCreationOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AUnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.recovery_point_id = kwargs.get('recovery_point_id', None) - self.cloud_service_creation_option = kwargs.get('cloud_service_creation_option', None) - - -class A2AUnprotectedDiskDetails(msrest.serialization.Model): - """A2A unprotected disk details. - - :param disk_lun_id: The source lun Id for the data disk. - :type disk_lun_id: int - :param disk_auto_protection_status: A value indicating whether the disk auto protection is - enabled. Possible values include: "Disabled", "Enabled". - :type disk_auto_protection_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - """ - - _attribute_map = { - 'disk_lun_id': {'key': 'diskLunId', 'type': 'int'}, - 'disk_auto_protection_status': {'key': 'diskAutoProtectionStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AUnprotectedDiskDetails, self).__init__(**kwargs) - self.disk_lun_id = kwargs.get('disk_lun_id', None) - self.disk_auto_protection_status = kwargs.get('disk_auto_protection_status', None) - - -class ReplicationProviderSpecificUpdateContainerMappingInput(msrest.serialization.Model): - """Provider specific input for update pairing operations. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AUpdateContainerMappingInput, InMageRcmUpdateContainerMappingInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AUpdateContainerMappingInput', 'InMageRcm': 'InMageRcmUpdateContainerMappingInput'} - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProviderSpecificUpdateContainerMappingInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AUpdateContainerMappingInput(ReplicationProviderSpecificUpdateContainerMappingInput): - """A2A update protection container mapping. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param agent_auto_update_status: A value indicating whether the auto update is enabled. - Possible values include: "Disabled", "Enabled". - :type agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :param automation_account_arm_id: The automation account arm id. - :type automation_account_arm_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'agent_auto_update_status': {'key': 'agentAutoUpdateStatus', 'type': 'str'}, - 'automation_account_arm_id': {'key': 'automationAccountArmId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AUpdateContainerMappingInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.agent_auto_update_status = kwargs.get('agent_auto_update_status', None) - self.automation_account_arm_id = kwargs.get('automation_account_arm_id', None) - - -class UpdateReplicationProtectedItemProviderInput(msrest.serialization.Model): - """Update replication protected item provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AUpdateReplicationProtectedItemInput, HyperVReplicaAzureUpdateReplicationProtectedItemInput, InMageAzureV2UpdateReplicationProtectedItemInput, InMageRcmUpdateReplicationProtectedItemInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'A2AUpdateReplicationProtectedItemInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureUpdateReplicationProtectedItemInput', 'InMageAzureV2': 'InMageAzureV2UpdateReplicationProtectedItemInput', 'InMageRcm': 'InMageRcmUpdateReplicationProtectedItemInput'} - } - - def __init__( - self, - **kwargs - ): - super(UpdateReplicationProtectedItemProviderInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class A2AUpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProviderInput): - """InMage Azure V2 input to update replication protected item. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_cloud_service_id: The target cloud service ARM Id (for V1). - :type recovery_cloud_service_id: str - :param recovery_resource_group_id: The target resource group ARM Id (for V2). - :type recovery_resource_group_id: str - :param managed_disk_update_details: Managed disk update details. - :type managed_disk_update_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskUpdateDetails] - :param recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account_id: str - :param disk_encryption_info: The recovery os disk encryption information. - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param tfo_azure_vm_name: The user given name for Test Failover VM. - :type tfo_azure_vm_name: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :type recovery_proximity_placement_group_id: str - :param recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set Id. - :type recovery_virtual_machine_scale_set_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_cloud_service_id': {'key': 'recoveryCloudServiceId', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'managed_disk_update_details': {'key': 'managedDiskUpdateDetails', 'type': '[A2AVmManagedDiskUpdateDetails]'}, - 'recovery_boot_diag_storage_account_id': {'key': 'recoveryBootDiagStorageAccountId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'tfo_azure_vm_name': {'key': 'tfoAzureVMName', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, - 'recovery_virtual_machine_scale_set_id': {'key': 'recoveryVirtualMachineScaleSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AUpdateReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.recovery_cloud_service_id = kwargs.get('recovery_cloud_service_id', None) - self.recovery_resource_group_id = kwargs.get('recovery_resource_group_id', None) - self.managed_disk_update_details = kwargs.get('managed_disk_update_details', None) - self.recovery_boot_diag_storage_account_id = kwargs.get('recovery_boot_diag_storage_account_id', None) - self.disk_encryption_info = kwargs.get('disk_encryption_info', None) - self.tfo_azure_vm_name = kwargs.get('tfo_azure_vm_name', None) - self.recovery_proximity_placement_group_id = kwargs.get('recovery_proximity_placement_group_id', None) - self.recovery_virtual_machine_scale_set_id = kwargs.get('recovery_virtual_machine_scale_set_id', None) - - -class A2AVmDiskInputDetails(msrest.serialization.Model): - """A2A disk input details. - - All required parameters must be populated in order to send to Azure. - - :param disk_uri: Required. The disk Uri. - :type disk_uri: str - :param recovery_azure_storage_account_id: Required. The recovery VHD storage account Id. - :type recovery_azure_storage_account_id: str - :param primary_staging_azure_storage_account_id: Required. The primary staging storage account - Id. - :type primary_staging_azure_storage_account_id: str - """ - - _validation = { - 'disk_uri': {'required': True}, - 'recovery_azure_storage_account_id': {'required': True}, - 'primary_staging_azure_storage_account_id': {'required': True}, - } - - _attribute_map = { - 'disk_uri': {'key': 'diskUri', 'type': 'str'}, - 'recovery_azure_storage_account_id': {'key': 'recoveryAzureStorageAccountId', 'type': 'str'}, - 'primary_staging_azure_storage_account_id': {'key': 'primaryStagingAzureStorageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AVmDiskInputDetails, self).__init__(**kwargs) - self.disk_uri = kwargs['disk_uri'] - self.recovery_azure_storage_account_id = kwargs['recovery_azure_storage_account_id'] - self.primary_staging_azure_storage_account_id = kwargs['primary_staging_azure_storage_account_id'] - - -class A2AVmManagedDiskInputDetails(msrest.serialization.Model): - """A2A managed disk input details. - - All required parameters must be populated in order to send to Azure. - - :param disk_id: Required. The disk Id. - :type disk_id: str - :param primary_staging_azure_storage_account_id: Required. The primary staging storage account - Arm Id. - :type primary_staging_azure_storage_account_id: str - :param recovery_resource_group_id: Required. The target resource group Arm Id. - :type recovery_resource_group_id: str - :param recovery_replica_disk_account_type: The replica disk type. Its an optional value and - will be same as source disk type if not user provided. - :type recovery_replica_disk_account_type: str - :param recovery_target_disk_account_type: The target disk type after failover. Its an optional - value and will be same as source disk type if not user provided. - :type recovery_target_disk_account_type: str - :param recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :type recovery_disk_encryption_set_id: str - :param disk_encryption_info: The recovery disk encryption information (for one / single pass - flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - - _validation = { - 'disk_id': {'required': True}, - 'primary_staging_azure_storage_account_id': {'required': True}, - 'recovery_resource_group_id': {'required': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'primary_staging_azure_storage_account_id': {'key': 'primaryStagingAzureStorageAccountId', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_replica_disk_account_type': {'key': 'recoveryReplicaDiskAccountType', 'type': 'str'}, - 'recovery_target_disk_account_type': {'key': 'recoveryTargetDiskAccountType', 'type': 'str'}, - 'recovery_disk_encryption_set_id': {'key': 'recoveryDiskEncryptionSetId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AVmManagedDiskInputDetails, self).__init__(**kwargs) - self.disk_id = kwargs['disk_id'] - self.primary_staging_azure_storage_account_id = kwargs['primary_staging_azure_storage_account_id'] - self.recovery_resource_group_id = kwargs['recovery_resource_group_id'] - self.recovery_replica_disk_account_type = kwargs.get('recovery_replica_disk_account_type', None) - self.recovery_target_disk_account_type = kwargs.get('recovery_target_disk_account_type', None) - self.recovery_disk_encryption_set_id = kwargs.get('recovery_disk_encryption_set_id', None) - self.disk_encryption_info = kwargs.get('disk_encryption_info', None) - - -class A2AVmManagedDiskUpdateDetails(msrest.serialization.Model): - """A2A Vm managed disk update details. - - :param disk_id: The disk Id. - :type disk_id: str - :param recovery_target_disk_account_type: The target disk type before failover. - :type recovery_target_disk_account_type: str - :param recovery_replica_disk_account_type: The replica disk type before failover. - :type recovery_replica_disk_account_type: str - :param disk_encryption_info: The recovery os disk encryption information. - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param failover_disk_name: The target disk name for unplanned failover operation. - :type failover_disk_name: str - :param tfo_disk_name: The target disk name for test failover operation. - :type tfo_disk_name: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'recovery_target_disk_account_type': {'key': 'recoveryTargetDiskAccountType', 'type': 'str'}, - 'recovery_replica_disk_account_type': {'key': 'recoveryReplicaDiskAccountType', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'failover_disk_name': {'key': 'failoverDiskName', 'type': 'str'}, - 'tfo_disk_name': {'key': 'tfoDiskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AVmManagedDiskUpdateDetails, self).__init__(**kwargs) - self.disk_id = kwargs.get('disk_id', None) - self.recovery_target_disk_account_type = kwargs.get('recovery_target_disk_account_type', None) - self.recovery_replica_disk_account_type = kwargs.get('recovery_replica_disk_account_type', None) - self.disk_encryption_info = kwargs.get('disk_encryption_info', None) - self.failover_disk_name = kwargs.get('failover_disk_name', None) - self.tfo_disk_name = kwargs.get('tfo_disk_name', None) - - -class A2AZoneDetails(msrest.serialization.Model): - """Zone details data. - - :param source: Source zone info. - :type source: str - :param target: The target zone info. - :type target: str - """ - - _attribute_map = { - 'source': {'key': 'source', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(A2AZoneDetails, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.target = kwargs.get('target', None) - - -class AddDisksInput(msrest.serialization.Model): - """Input for add disk(s) operation. - - :param properties: Add disks input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'AddDisksInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AddDisksInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class AddDisksInputProperties(msrest.serialization.Model): - """Add Disks input properties. - - All required parameters must be populated in order to send to Azure. - - :param provider_specific_details: Required. The ReplicationProviderInput. For - HyperVReplicaAzure provider, it will be AzureEnableProtectionInput object. For San provider, it - will be SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput - """ - - _validation = { - 'provider_specific_details': {'required': True}, - } - - _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'AddDisksProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(AddDisksInputProperties, self).__init__(**kwargs) - self.provider_specific_details = kwargs['provider_specific_details'] - - -class AddRecoveryServicesProviderInput(msrest.serialization.Model): - """Input required to add a provider. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. The properties of an add provider request. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'AddRecoveryServicesProviderInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AddRecoveryServicesProviderInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class AddRecoveryServicesProviderInputProperties(msrest.serialization.Model): - """The properties of an add provider request. - - All required parameters must be populated in order to send to Azure. - - :param machine_name: Required. The name of the machine where the provider is getting added. - :type machine_name: str - :param machine_id: The Id of the machine where the provider is getting added. - :type machine_id: str - :param bios_id: The Bios Id of the machine. - :type bios_id: str - :param authentication_identity_input: Required. The identity provider input for DRA - authentication. - :type authentication_identity_input: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - :param resource_access_identity_input: Required. The identity provider input for resource - access. - :type resource_access_identity_input: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - :param data_plane_authentication_identity_input: The identity provider input for data plane - authentication. - :type data_plane_authentication_identity_input: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - """ - - _validation = { - 'machine_name': {'required': True}, - 'authentication_identity_input': {'required': True}, - 'resource_access_identity_input': {'required': True}, - } - - _attribute_map = { - 'machine_name': {'key': 'machineName', 'type': 'str'}, - 'machine_id': {'key': 'machineId', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'authentication_identity_input': {'key': 'authenticationIdentityInput', 'type': 'IdentityProviderInput'}, - 'resource_access_identity_input': {'key': 'resourceAccessIdentityInput', 'type': 'IdentityProviderInput'}, - 'data_plane_authentication_identity_input': {'key': 'dataPlaneAuthenticationIdentityInput', 'type': 'IdentityProviderInput'}, - } - - def __init__( - self, - **kwargs - ): - super(AddRecoveryServicesProviderInputProperties, self).__init__(**kwargs) - self.machine_name = kwargs['machine_name'] - self.machine_id = kwargs.get('machine_id', None) - self.bios_id = kwargs.get('bios_id', None) - self.authentication_identity_input = kwargs['authentication_identity_input'] - self.resource_access_identity_input = kwargs['resource_access_identity_input'] - self.data_plane_authentication_identity_input = kwargs.get('data_plane_authentication_identity_input', None) - - -class AddVCenterRequest(msrest.serialization.Model): - """Input required to add vCenter. - - :param properties: The properties of an add vCenter request. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequestProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'AddVCenterRequestProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AddVCenterRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class AddVCenterRequestProperties(msrest.serialization.Model): - """The properties of an add vCenter request. - - :param friendly_name: The friendly name of the vCenter. - :type friendly_name: str - :param ip_address: The IP address of the vCenter to be discovered. - :type ip_address: str - :param process_server_id: The process server Id from where the discovery is orchestrated. - :type process_server_id: str - :param port: The port number for discovery. - :type port: str - :param run_as_account_id: The account Id which has privileges to discover the vCenter. - :type run_as_account_id: str - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AddVCenterRequestProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.ip_address = kwargs.get('ip_address', None) - self.process_server_id = kwargs.get('process_server_id', None) - self.port = kwargs.get('port', None) - self.run_as_account_id = kwargs.get('run_as_account_id', None) - - -class AgentDetails(msrest.serialization.Model): - """Agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar agent_id: The Id of the agent running on the server. - :vartype agent_id: str - :ivar machine_id: The Id of the machine to which the agent is registered. - :vartype machine_id: str - :ivar bios_id: The machine BIOS Id. - :vartype bios_id: str - :ivar fqdn: The machine FQDN. - :vartype fqdn: str - :ivar disks: The disks. - :vartype disks: list[~azure.mgmt.recoveryservicessiterecovery.models.AgentDiskDetails] - """ - - _validation = { - 'agent_id': {'readonly': True}, - 'machine_id': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'disks': {'readonly': True}, - } - - _attribute_map = { - 'agent_id': {'key': 'agentId', 'type': 'str'}, - 'machine_id': {'key': 'machineId', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'disks': {'key': 'disks', 'type': '[AgentDiskDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(AgentDetails, self).__init__(**kwargs) - self.agent_id = None - self.machine_id = None - self.bios_id = None - self.fqdn = None - self.disks = None - - -class AgentDiskDetails(msrest.serialization.Model): - """Agent disk details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_id: The disk Id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar is_os_disk: A value indicating whether the disk is the OS disk. - :vartype is_os_disk: str - :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: long - :ivar lun_id: The lun of disk. - :vartype lun_id: int - """ - - _validation = { - 'disk_id': {'readonly': True}, - 'disk_name': {'readonly': True}, - 'is_os_disk': {'readonly': True}, - 'capacity_in_bytes': {'readonly': True}, - 'lun_id': {'readonly': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'lun_id': {'key': 'lunId', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AgentDiskDetails, self).__init__(**kwargs) - self.disk_id = None - self.disk_name = None - self.is_os_disk = None - self.capacity_in_bytes = None - self.lun_id = None - - -class Resource(msrest.serialization.Model): - """Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - - -class Alert(Resource): - """Implements the Alert class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Alert related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.AlertProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'AlertProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Alert, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class AlertCollection(msrest.serialization.Model): - """Collection of alerts. - - :param value: The list of alerts. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Alert] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Alert]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AlertProperties(msrest.serialization.Model): - """The properties of an alert. - - :param send_to_owners: A value indicating whether to send email to subscription administrator. - :type send_to_owners: str - :param custom_email_addresses: The custom email address for sending emails. - :type custom_email_addresses: list[str] - :param locale: The locale for the email notification. - :type locale: str - """ - - _attribute_map = { - 'send_to_owners': {'key': 'sendToOwners', 'type': 'str'}, - 'custom_email_addresses': {'key': 'customEmailAddresses', 'type': '[str]'}, - 'locale': {'key': 'locale', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertProperties, self).__init__(**kwargs) - self.send_to_owners = kwargs.get('send_to_owners', None) - self.custom_email_addresses = kwargs.get('custom_email_addresses', None) - self.locale = kwargs.get('locale', None) - - -class ApplyRecoveryPointInput(msrest.serialization.Model): - """Input to apply recovery point. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. The input properties to apply recovery point. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ApplyRecoveryPointInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplyRecoveryPointInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class ApplyRecoveryPointInputProperties(msrest.serialization.Model): - """Input properties to apply recovery point. - - All required parameters must be populated in order to send to Azure. - - :param recovery_point_id: The recovery point Id. - :type recovery_point_id: str - :param provider_specific_details: Required. Provider specific input for applying recovery - point. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput - """ - - _validation = { - 'provider_specific_details': {'required': True}, - } - - _attribute_map = { - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ApplyRecoveryPointProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplyRecoveryPointInputProperties, self).__init__(**kwargs) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - self.provider_specific_details = kwargs['provider_specific_details'] - - -class JobDetails(msrest.serialization.Model): - """Job details based on specific job type. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AsrJobDetails, ExportJobDetails, FailoverJobDetails, SwitchProtectionJobDetails, TestFailoverJobDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - } - - _subtype_map = { - 'instance_type': {'AsrJobDetails': 'AsrJobDetails', 'ExportJobDetails': 'ExportJobDetails', 'FailoverJobDetails': 'FailoverJobDetails', 'SwitchProtectionJobDetails': 'SwitchProtectionJobDetails', 'TestFailoverJobDetails': 'TestFailoverJobDetails'} - } - - def __init__( - self, - **kwargs - ): - super(JobDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - self.affected_object_details = kwargs.get('affected_object_details', None) - - -class AsrJobDetails(JobDetails): - """This class represents job details based on specific job type. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(AsrJobDetails, self).__init__(**kwargs) - self.instance_type = 'AsrJobDetails' # type: str - - -class ASRTask(msrest.serialization.Model): - """Task of the Job. - - :param task_id: The Id. - :type task_id: str - :param name: The unique Task name. - :type name: str - :param start_time: The start time. - :type start_time: ~datetime.datetime - :param end_time: The end time. - :type end_time: ~datetime.datetime - :param allowed_actions: The state/actions applicable on this task. - :type allowed_actions: list[str] - :param friendly_name: The name. - :type friendly_name: str - :param state: The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, - Cancelled, Suspended or Other. - :type state: str - :param state_description: The description of the task state. For example - For Succeeded state, - description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - :type state_description: str - :param task_type: The type of task. Details in CustomDetails property depend on this type. - :type task_type: str - :param custom_details: The custom task details based on the task type. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.TaskTypeDetails - :param group_task_custom_details: The custom task details based on the task type, if the task - type is GroupTaskDetails or one of the types derived from it. - :type group_task_custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.GroupTaskDetails - :param errors: The task error details. - :type errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] - """ - - _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'allowed_actions': {'key': 'allowedActions', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'state_description': {'key': 'stateDescription', 'type': 'str'}, - 'task_type': {'key': 'taskType', 'type': 'str'}, - 'custom_details': {'key': 'customDetails', 'type': 'TaskTypeDetails'}, - 'group_task_custom_details': {'key': 'groupTaskCustomDetails', 'type': 'GroupTaskDetails'}, - 'errors': {'key': 'errors', 'type': '[JobErrorDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(ASRTask, self).__init__(**kwargs) - self.task_id = kwargs.get('task_id', None) - self.name = kwargs.get('name', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.allowed_actions = kwargs.get('allowed_actions', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.state = kwargs.get('state', None) - self.state_description = kwargs.get('state_description', None) - self.task_type = kwargs.get('task_type', None) - self.custom_details = kwargs.get('custom_details', None) - self.group_task_custom_details = kwargs.get('group_task_custom_details', None) - self.errors = kwargs.get('errors', None) - - -class TaskTypeDetails(msrest.serialization.Model): - """Task details based on specific task type. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AutomationRunbookTaskDetails, ConsistencyCheckTaskDetails, JobTaskDetails, ManualActionTaskDetails, ScriptActionTaskDetails, VmNicUpdatesTaskDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'AutomationRunbookTaskDetails': 'AutomationRunbookTaskDetails', 'ConsistencyCheckTaskDetails': 'ConsistencyCheckTaskDetails', 'JobTaskDetails': 'JobTaskDetails', 'ManualActionTaskDetails': 'ManualActionTaskDetails', 'ScriptActionTaskDetails': 'ScriptActionTaskDetails', 'VmNicUpdatesTaskDetails': 'VmNicUpdatesTaskDetails'} - } - - def __init__( - self, - **kwargs - ): - super(TaskTypeDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class AutomationRunbookTaskDetails(TaskTypeDetails): - """This class represents the task details for an automation runbook. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param name: The recovery plan task name. - :type name: str - :param cloud_service_name: The cloud service of the automation runbook account. - :type cloud_service_name: str - :param subscription_id: The subscription Id of the automation runbook account. - :type subscription_id: str - :param account_name: The automation account name of the runbook. - :type account_name: str - :param runbook_id: The runbook Id. - :type runbook_id: str - :param runbook_name: The runbook name. - :type runbook_name: str - :param job_id: The job Id of the runbook execution. - :type job_id: str - :param job_output: The execution output of the runbook. - :type job_output: str - :param is_primary_side_script: A value indicating whether it is a primary side script or not. - :type is_primary_side_script: bool - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'cloud_service_name': {'key': 'cloudServiceName', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'runbook_id': {'key': 'runbookId', 'type': 'str'}, - 'runbook_name': {'key': 'runbookName', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'job_output': {'key': 'jobOutput', 'type': 'str'}, - 'is_primary_side_script': {'key': 'isPrimarySideScript', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AutomationRunbookTaskDetails, self).__init__(**kwargs) - self.instance_type = 'AutomationRunbookTaskDetails' # type: str - self.name = kwargs.get('name', None) - self.cloud_service_name = kwargs.get('cloud_service_name', None) - self.subscription_id = kwargs.get('subscription_id', None) - self.account_name = kwargs.get('account_name', None) - self.runbook_id = kwargs.get('runbook_id', None) - self.runbook_name = kwargs.get('runbook_name', None) - self.job_id = kwargs.get('job_id', None) - self.job_output = kwargs.get('job_output', None) - self.is_primary_side_script = kwargs.get('is_primary_side_script', None) - - -class FabricSpecificCreationInput(msrest.serialization.Model): - """Fabric provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFabricCreationInput, InMageRcmFabricCreationInput, VMwareV2FabricCreationInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'Azure': 'AzureFabricCreationInput', 'InMageRcm': 'InMageRcmFabricCreationInput', 'VMwareV2': 'VMwareV2FabricCreationInput'} - } - - def __init__( - self, - **kwargs - ): - super(FabricSpecificCreationInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class AzureFabricCreationInput(FabricSpecificCreationInput): - """Fabric provider specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type.Constant filled by server. - :type instance_type: str - :param location: The Location. - :type location: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFabricCreationInput, self).__init__(**kwargs) - self.instance_type = 'Azure' # type: str - self.location = kwargs.get('location', None) - - -class FabricSpecificDetails(msrest.serialization.Model): - """Fabric specific details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFabricSpecificDetails, HyperVSiteDetails, InMageRcmFabricSpecificDetails, VmmDetails, VMwareDetails, VMwareV2FabricSpecificDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'Azure': 'AzureFabricSpecificDetails', 'HyperVSite': 'HyperVSiteDetails', 'InMageRcm': 'InMageRcmFabricSpecificDetails', 'VMM': 'VmmDetails', 'VMware': 'VMwareDetails', 'VMwareV2': 'VMwareV2FabricSpecificDetails'} - } - - def __init__( - self, - **kwargs - ): - super(FabricSpecificDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class AzureFabricSpecificDetails(FabricSpecificDetails): - """Azure Fabric Specific Details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param location: The Location for the Azure fabric. - :type location: str - :param container_ids: The container Ids for the Azure fabric. - :type container_ids: list[str] - :param zones: The zones. - :type zones: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AZoneDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'container_ids': {'key': 'containerIds', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[A2AZoneDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFabricSpecificDetails, self).__init__(**kwargs) - self.instance_type = 'Azure' # type: str - self.location = kwargs.get('location', None) - self.container_ids = kwargs.get('container_ids', None) - self.zones = kwargs.get('zones', None) - - -class FabricSpecificCreateNetworkMappingInput(msrest.serialization.Model): - """Input details specific to fabrics during Network Mapping. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureToAzureCreateNetworkMappingInput, VmmToAzureCreateNetworkMappingInput, VmmToVmmCreateNetworkMappingInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'AzureToAzure': 'AzureToAzureCreateNetworkMappingInput', 'VmmToAzure': 'VmmToAzureCreateNetworkMappingInput', 'VmmToVmm': 'VmmToVmmCreateNetworkMappingInput'} - } - - def __init__( - self, - **kwargs - ): - super(FabricSpecificCreateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class AzureToAzureCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput): - """Create network mappings input properties/behavior specific to Azure to Azure Network mapping. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - :param primary_network_id: Required. The primary azure vnet Id. - :type primary_network_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'primary_network_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_network_id': {'key': 'primaryNetworkId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureToAzureCreateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'AzureToAzure' # type: str - self.primary_network_id = kwargs['primary_network_id'] - - -class NetworkMappingFabricSpecificSettings(msrest.serialization.Model): - """Network Mapping fabric specific settings. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureToAzureNetworkMappingSettings, VmmToAzureNetworkMappingSettings, VmmToVmmNetworkMappingSettings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'AzureToAzure': 'AzureToAzureNetworkMappingSettings', 'VmmToAzure': 'VmmToAzureNetworkMappingSettings', 'VmmToVmm': 'VmmToVmmNetworkMappingSettings'} - } - - def __init__( - self, - **kwargs - ): - super(NetworkMappingFabricSpecificSettings, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class AzureToAzureNetworkMappingSettings(NetworkMappingFabricSpecificSettings): - """A2A Network Mapping fabric specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param primary_fabric_location: The primary fabric location. - :type primary_fabric_location: str - :param recovery_fabric_location: The recovery fabric location. - :type recovery_fabric_location: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_fabric_location': {'key': 'primaryFabricLocation', 'type': 'str'}, - 'recovery_fabric_location': {'key': 'recoveryFabricLocation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureToAzureNetworkMappingSettings, self).__init__(**kwargs) - self.instance_type = 'AzureToAzure' # type: str - self.primary_fabric_location = kwargs.get('primary_fabric_location', None) - self.recovery_fabric_location = kwargs.get('recovery_fabric_location', None) - - -class FabricSpecificUpdateNetworkMappingInput(msrest.serialization.Model): - """Input details specific to fabrics during Network Mapping. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureToAzureUpdateNetworkMappingInput, VmmToAzureUpdateNetworkMappingInput, VmmToVmmUpdateNetworkMappingInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'AzureToAzure': 'AzureToAzureUpdateNetworkMappingInput', 'VmmToAzure': 'VmmToAzureUpdateNetworkMappingInput', 'VmmToVmm': 'VmmToVmmUpdateNetworkMappingInput'} - } - - def __init__( - self, - **kwargs - ): - super(FabricSpecificUpdateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class AzureToAzureUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput): - """Updates network mappings input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - :param primary_network_id: The primary azure vnet Id. - :type primary_network_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_network_id': {'key': 'primaryNetworkId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureToAzureUpdateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'AzureToAzure' # type: str - self.primary_network_id = kwargs.get('primary_network_id', None) - - -class AzureToAzureVmSyncedConfigDetails(msrest.serialization.Model): - """Azure to Azure VM synced configuration details. - - :param tags: A set of tags. The Azure VM tags. - :type tags: dict[str, str] - :param input_endpoints: The Azure VM input endpoints. - :type input_endpoints: list[~azure.mgmt.recoveryservicessiterecovery.models.InputEndpoint] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'input_endpoints': {'key': 'inputEndpoints', 'type': '[InputEndpoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureToAzureVmSyncedConfigDetails, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.input_endpoints = kwargs.get('input_endpoints', None) - - -class AzureVmDiskDetails(msrest.serialization.Model): - """Disk details for E2A provider. - - :param vhd_type: VHD type. - :type vhd_type: str - :param vhd_id: The VHD id. - :type vhd_id: str - :param disk_id: The disk resource id. - :type disk_id: str - :param vhd_name: VHD name. - :type vhd_name: str - :param max_size_mb: Max side in MB. - :type max_size_mb: str - :param target_disk_location: Blob uri of the Azure disk. - :type target_disk_location: str - :param target_disk_name: The target Azure disk name. - :type target_disk_name: str - :param lun_id: Ordinal\LunId of the disk for the Azure VM. - :type lun_id: str - :param disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :type disk_encryption_set_id: str - :param custom_target_disk_name: The custom target Azure disk name. - :type custom_target_disk_name: str - """ - - _attribute_map = { - 'vhd_type': {'key': 'vhdType', 'type': 'str'}, - 'vhd_id': {'key': 'vhdId', 'type': 'str'}, - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'vhd_name': {'key': 'vhdName', 'type': 'str'}, - 'max_size_mb': {'key': 'maxSizeMB', 'type': 'str'}, - 'target_disk_location': {'key': 'targetDiskLocation', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, - 'lun_id': {'key': 'lunId', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'custom_target_disk_name': {'key': 'customTargetDiskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureVmDiskDetails, self).__init__(**kwargs) - self.vhd_type = kwargs.get('vhd_type', None) - self.vhd_id = kwargs.get('vhd_id', None) - self.disk_id = kwargs.get('disk_id', None) - self.vhd_name = kwargs.get('vhd_name', None) - self.max_size_mb = kwargs.get('max_size_mb', None) - self.target_disk_location = kwargs.get('target_disk_location', None) - self.target_disk_name = kwargs.get('target_disk_name', None) - self.lun_id = kwargs.get('lun_id', None) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.custom_target_disk_name = kwargs.get('custom_target_disk_name', None) - - -class ComputeSizeErrorDetails(msrest.serialization.Model): - """Represents the error used to indicate why the target compute size is not applicable. - - :param message: The error message. - :type message: str - :param severity: The severity of the error. - :type severity: str - """ - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'severity': {'key': 'severity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeSizeErrorDetails, self).__init__(**kwargs) - self.message = kwargs.get('message', None) - self.severity = kwargs.get('severity', None) - - -class ConfigurationSettings(msrest.serialization.Model): - """Replication provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: HyperVVirtualMachineDetails, ReplicationGroupDetails, VMwareVirtualMachineDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'HyperVVirtualMachine': 'HyperVVirtualMachineDetails', 'ReplicationGroupDetails': 'ReplicationGroupDetails', 'VMwareVirtualMachine': 'VMwareVirtualMachineDetails'} - } - - def __init__( - self, - **kwargs - ): - super(ConfigurationSettings, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class ConfigureAlertRequest(msrest.serialization.Model): - """Request to configure alerts for the system. - - :param properties: The properties of a configure alert request. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ConfigureAlertRequestProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigureAlertRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ConfigureAlertRequestProperties(msrest.serialization.Model): - """Properties of a configure alert request. - - :param send_to_owners: A value indicating whether to send email to subscription administrator. - :type send_to_owners: str - :param custom_email_addresses: The custom email address for sending emails. - :type custom_email_addresses: list[str] - :param locale: The locale for the email notification. - :type locale: str - """ - - _attribute_map = { - 'send_to_owners': {'key': 'sendToOwners', 'type': 'str'}, - 'custom_email_addresses': {'key': 'customEmailAddresses', 'type': '[str]'}, - 'locale': {'key': 'locale', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigureAlertRequestProperties, self).__init__(**kwargs) - self.send_to_owners = kwargs.get('send_to_owners', None) - self.custom_email_addresses = kwargs.get('custom_email_addresses', None) - self.locale = kwargs.get('locale', None) - - -class ConsistencyCheckTaskDetails(TaskTypeDetails): - """This class contains monitoring details of all the inconsistent Protected Entities in Vmm. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param vm_details: The list of inconsistent Vm details. - :type vm_details: list[~azure.mgmt.recoveryservicessiterecovery.models.InconsistentVmDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_details': {'key': 'vmDetails', 'type': '[InconsistentVmDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConsistencyCheckTaskDetails, self).__init__(**kwargs) - self.instance_type = 'ConsistencyCheckTaskDetails' # type: str - self.vm_details = kwargs.get('vm_details', None) - - -class CreateNetworkMappingInput(msrest.serialization.Model): - """Create network mappings input. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Input properties for creating network mapping. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateNetworkMappingInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateNetworkMappingInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class CreateNetworkMappingInputProperties(msrest.serialization.Model): - """Common input details for network mapping operation. - - All required parameters must be populated in order to send to Azure. - - :param recovery_fabric_name: Recovery fabric Name. - :type recovery_fabric_name: str - :param recovery_network_id: Required. Recovery network Id. - :type recovery_network_id: str - :param fabric_specific_details: Fabric specific input properties. - :type fabric_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput - """ - - _validation = { - 'recovery_network_id': {'required': True}, - } - - _attribute_map = { - 'recovery_fabric_name': {'key': 'recoveryFabricName', 'type': 'str'}, - 'recovery_network_id': {'key': 'recoveryNetworkId', 'type': 'str'}, - 'fabric_specific_details': {'key': 'fabricSpecificDetails', 'type': 'FabricSpecificCreateNetworkMappingInput'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateNetworkMappingInputProperties, self).__init__(**kwargs) - self.recovery_fabric_name = kwargs.get('recovery_fabric_name', None) - self.recovery_network_id = kwargs['recovery_network_id'] - self.fabric_specific_details = kwargs.get('fabric_specific_details', None) - - -class CreatePolicyInput(msrest.serialization.Model): - """Protection Policy input. - - :param properties: Policy creation properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreatePolicyInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CreatePolicyInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class CreatePolicyInputProperties(msrest.serialization.Model): - """Policy creation properties. - - :param provider_specific_input: The ReplicationProviderSettings. - :type provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput - """ - - _attribute_map = { - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': 'PolicyProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(CreatePolicyInputProperties, self).__init__(**kwargs) - self.provider_specific_input = kwargs.get('provider_specific_input', None) - - -class CreateProtectionContainerInput(msrest.serialization.Model): - """Create protection container input. - - :param properties: Create protection container input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateProtectionContainerInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateProtectionContainerInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class CreateProtectionContainerInputProperties(msrest.serialization.Model): - """Create protection container input properties. - - :param provider_specific_input: Provider specific inputs for container creation. - :type provider_specific_input: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput] - """ - - _attribute_map = { - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': '[ReplicationProviderSpecificContainerCreationInput]'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateProtectionContainerInputProperties, self).__init__(**kwargs) - self.provider_specific_input = kwargs.get('provider_specific_input', None) - - -class CreateProtectionContainerMappingInput(msrest.serialization.Model): - """Configure pairing input. - - :param properties: Configure protection input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateProtectionContainerMappingInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateProtectionContainerMappingInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class CreateProtectionContainerMappingInputProperties(msrest.serialization.Model): - """Configure pairing input properties. - - :param target_protection_container_id: The target unique protection container name. - :type target_protection_container_id: str - :param policy_id: Applicable policy. - :type policy_id: str - :param provider_specific_input: Provider specific input for pairing. - :type provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput - """ - - _attribute_map = { - 'target_protection_container_id': {'key': 'targetProtectionContainerId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': 'ReplicationProviderSpecificContainerMappingInput'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateProtectionContainerMappingInputProperties, self).__init__(**kwargs) - self.target_protection_container_id = kwargs.get('target_protection_container_id', None) - self.policy_id = kwargs.get('policy_id', None) - self.provider_specific_input = kwargs.get('provider_specific_input', None) - - -class CreateProtectionIntentInput(msrest.serialization.Model): - """Create protection intent input. - - :param properties: Create protection intent input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateProtectionIntentProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateProtectionIntentInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class CreateProtectionIntentProperties(msrest.serialization.Model): - """Create protection intent input properties. - - :param provider_specific_details: The ReplicationProviderInput. For A2A provider, it will be - A2ACreateProtectionIntentInput object. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails - """ - - _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'CreateProtectionIntentProviderSpecificDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateProtectionIntentProperties, self).__init__(**kwargs) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class CreateRecoveryPlanInput(msrest.serialization.Model): - """Create recovery plan input class. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Recovery plan creation properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateRecoveryPlanInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateRecoveryPlanInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class CreateRecoveryPlanInputProperties(msrest.serialization.Model): - """Recovery plan creation properties. - - All required parameters must be populated in order to send to Azure. - - :param primary_fabric_id: Required. The primary fabric Id. - :type primary_fabric_id: str - :param recovery_fabric_id: Required. The recovery fabric Id. - :type recovery_fabric_id: str - :param failover_deployment_model: The failover deployment model. Possible values include: - "NotApplicable", "Classic", "ResourceManager". - :type failover_deployment_model: str or - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverDeploymentModel - :param groups: Required. The recovery plan groups. - :type groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - :param provider_specific_input: The provider specific input. - :type provider_specific_input: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput] - """ - - _validation = { - 'primary_fabric_id': {'required': True}, - 'recovery_fabric_id': {'required': True}, - 'groups': {'required': True}, - } - - _attribute_map = { - 'primary_fabric_id': {'key': 'primaryFabricId', 'type': 'str'}, - 'recovery_fabric_id': {'key': 'recoveryFabricId', 'type': 'str'}, - 'failover_deployment_model': {'key': 'failoverDeploymentModel', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[RecoveryPlanGroup]'}, - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': '[RecoveryPlanProviderSpecificInput]'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateRecoveryPlanInputProperties, self).__init__(**kwargs) - self.primary_fabric_id = kwargs['primary_fabric_id'] - self.recovery_fabric_id = kwargs['recovery_fabric_id'] - self.failover_deployment_model = kwargs.get('failover_deployment_model', None) - self.groups = kwargs['groups'] - self.provider_specific_input = kwargs.get('provider_specific_input', None) - - -class CurrentJobDetails(msrest.serialization.Model): - """Current job details of the migration item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar job_name: The job name. - :vartype job_name: str - :ivar job_id: The ARM Id of the job being executed. - :vartype job_id: str - :ivar start_time: The start time of the job. - :vartype start_time: ~datetime.datetime - """ - - _validation = { - 'job_name': {'readonly': True}, - 'job_id': {'readonly': True}, - 'start_time': {'readonly': True}, - } - - _attribute_map = { - 'job_name': {'key': 'jobName', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(CurrentJobDetails, self).__init__(**kwargs) - self.job_name = None - self.job_id = None - self.start_time = None - - -class CurrentScenarioDetails(msrest.serialization.Model): - """Current scenario details of the protected entity. - - :param scenario_name: Scenario name. - :type scenario_name: str - :param job_id: ARM Id of the job being executed. - :type job_id: str - :param start_time: Start time of the workflow. - :type start_time: ~datetime.datetime - """ - - _attribute_map = { - 'scenario_name': {'key': 'scenarioName', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(CurrentScenarioDetails, self).__init__(**kwargs) - self.scenario_name = kwargs.get('scenario_name', None) - self.job_id = kwargs.get('job_id', None) - self.start_time = kwargs.get('start_time', None) - - -class DataStore(msrest.serialization.Model): - """The datastore details of the MT. - - :param symbolic_name: The symbolic name of data store. - :type symbolic_name: str - :param uuid: The uuid of data store. - :type uuid: str - :param capacity: The capacity of data store in GBs. - :type capacity: str - :param free_space: The free space of data store in GBs. - :type free_space: str - :param type: The type of data store. - :type type: str - """ - - _attribute_map = { - 'symbolic_name': {'key': 'symbolicName', 'type': 'str'}, - 'uuid': {'key': 'uuid', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'str'}, - 'free_space': {'key': 'freeSpace', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataStore, self).__init__(**kwargs) - self.symbolic_name = kwargs.get('symbolic_name', None) - self.uuid = kwargs.get('uuid', None) - self.capacity = kwargs.get('capacity', None) - self.free_space = kwargs.get('free_space', None) - self.type = kwargs.get('type', None) - - -class DisableProtectionInput(msrest.serialization.Model): - """Disable protection input. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Disable protection input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'DisableProtectionInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DisableProtectionInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class DisableProtectionInputProperties(msrest.serialization.Model): - """Disable protection input properties. - - :param disable_protection_reason: Disable protection reason. It can have values - NotSpecified/MigrationComplete. Possible values include: "NotSpecified", "MigrationComplete". - :type disable_protection_reason: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionReason - :param replication_provider_input: Replication provider specific input. - :type replication_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput - """ - - _attribute_map = { - 'disable_protection_reason': {'key': 'disableProtectionReason', 'type': 'str'}, - 'replication_provider_input': {'key': 'replicationProviderInput', 'type': 'DisableProtectionProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(DisableProtectionInputProperties, self).__init__(**kwargs) - self.disable_protection_reason = kwargs.get('disable_protection_reason', None) - self.replication_provider_input = kwargs.get('replication_provider_input', None) - - -class DisableProtectionProviderSpecificInput(msrest.serialization.Model): - """Disable protection provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: InMageDisableProtectionProviderSpecificInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'InMage': 'InMageDisableProtectionProviderSpecificInput'} - } - - def __init__( - self, - **kwargs - ): - super(DisableProtectionProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class DiscoverProtectableItemRequest(msrest.serialization.Model): - """Request to add a physical machine as a protectable item in a container. - - :param properties: The properties of a discover protectable item request. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequestProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'DiscoverProtectableItemRequestProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DiscoverProtectableItemRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class DiscoverProtectableItemRequestProperties(msrest.serialization.Model): - """Discover protectable item properties. - - :param friendly_name: The friendly name of the physical machine. - :type friendly_name: str - :param ip_address: The IP address of the physical machine to be discovered. - :type ip_address: str - :param os_type: The OS type on the physical machine. - :type os_type: str - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiscoverProtectableItemRequestProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.ip_address = kwargs.get('ip_address', None) - self.os_type = kwargs.get('os_type', None) - - -class DiskDetails(msrest.serialization.Model): - """Onprem disk details data. - - :param max_size_mb: The hard disk max size in MB. - :type max_size_mb: long - :param vhd_type: The type of the volume. - :type vhd_type: str - :param vhd_id: The VHD Id. - :type vhd_id: str - :param vhd_name: The VHD name. - :type vhd_name: str - """ - - _attribute_map = { - 'max_size_mb': {'key': 'maxSizeMB', 'type': 'long'}, - 'vhd_type': {'key': 'vhdType', 'type': 'str'}, - 'vhd_id': {'key': 'vhdId', 'type': 'str'}, - 'vhd_name': {'key': 'vhdName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskDetails, self).__init__(**kwargs) - self.max_size_mb = kwargs.get('max_size_mb', None) - self.vhd_type = kwargs.get('vhd_type', None) - self.vhd_id = kwargs.get('vhd_id', None) - self.vhd_name = kwargs.get('vhd_name', None) - - -class DiskEncryptionInfo(msrest.serialization.Model): - """Recovery disk encryption info (BEK and KEK). - - :param disk_encryption_key_info: The recovery KeyVault reference for secret. - :type disk_encryption_key_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionKeyInfo - :param key_encryption_key_info: The recovery KeyVault reference for key. - :type key_encryption_key_info: - ~azure.mgmt.recoveryservicessiterecovery.models.KeyEncryptionKeyInfo - """ - - _attribute_map = { - 'disk_encryption_key_info': {'key': 'diskEncryptionKeyInfo', 'type': 'DiskEncryptionKeyInfo'}, - 'key_encryption_key_info': {'key': 'keyEncryptionKeyInfo', 'type': 'KeyEncryptionKeyInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionInfo, self).__init__(**kwargs) - self.disk_encryption_key_info = kwargs.get('disk_encryption_key_info', None) - self.key_encryption_key_info = kwargs.get('key_encryption_key_info', None) - - -class DiskEncryptionKeyInfo(msrest.serialization.Model): - """Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). - - :param secret_identifier: The secret url / identifier. - :type secret_identifier: str - :param key_vault_resource_arm_id: The KeyVault resource ARM id for secret. - :type key_vault_resource_arm_id: str - """ - - _attribute_map = { - 'secret_identifier': {'key': 'secretIdentifier', 'type': 'str'}, - 'key_vault_resource_arm_id': {'key': 'keyVaultResourceArmId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionKeyInfo, self).__init__(**kwargs) - self.secret_identifier = kwargs.get('secret_identifier', None) - self.key_vault_resource_arm_id = kwargs.get('key_vault_resource_arm_id', None) - - -class DiskVolumeDetails(msrest.serialization.Model): - """Volume details. - - :param label: The volume label. - :type label: str - :param name: The volume name. - :type name: str - """ - - _attribute_map = { - 'label': {'key': 'label', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskVolumeDetails, self).__init__(**kwargs) - self.label = kwargs.get('label', None) - self.name = kwargs.get('name', None) - - -class Display(msrest.serialization.Model): - """Contains the localized display information for this particular operation / action. These value will be used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for the event service; and (3) audit history / records for management operations. - - :param provider: The provider. The localized friendly form of the resource provider name - it - is expected to also include the publisher/company responsible. It should use Title Casing and - begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or - "Microsoft Compute.". - :type provider: str - :param resource: The resource. The localized friendly form of the resource related to this - action/operation - it should match the public documentation for the resource provider. It - should use Title Casing. This value should be unique for a particular URL type (e.g. nested - types should *not* reuse their parent's display.resource field). e.g. "Virtual Machines" or - "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs". - :type resource: str - :param operation: The operation. The localized friendly name for the operation, as it should be - shown to the user. It should be concise (to fit in drop downs) but clear (i.e. - self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update - Delete 'ActionName'. - :type operation: str - :param description: The description. The localized friendly description for the operation, as - it should be shown to the user. It should be thorough, yet concise - it will be used in tool - tips and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' - resource Create or Update any 'display.provider' resource Delete any 'display.provider' - resource Perform any other action on any 'display.provider' resource Prescriptive guidance for - namespaces: Read any 'display.resource' Create or Update any 'display.resource' Delete any - 'display.resource' 'ActionName' any 'display.resources'. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Display, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class DraDetails(msrest.serialization.Model): - """DRA details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The DRA Id. - :vartype id: str - :ivar name: The DRA name. - :vartype name: str - :ivar bios_id: The DRA Bios Id. - :vartype bios_id: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the DRA. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health. Possible values include: "None", "Normal", "Warning", "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar forward_protected_item_count: The count of protected items which are protected in forward - direction. - :vartype forward_protected_item_count: int - :ivar reverse_protected_item_count: The count of protected items which are protected in reverse - direction. - :vartype reverse_protected_item_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - 'forward_protected_item_count': {'readonly': True}, - 'reverse_protected_item_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'forward_protected_item_count': {'key': 'forwardProtectedItemCount', 'type': 'int'}, - 'reverse_protected_item_count': {'key': 'reverseProtectedItemCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DraDetails, self).__init__(**kwargs) - self.id = None - self.name = None - self.bios_id = None - self.version = None - self.last_heartbeat_utc = None - self.health = None - self.health_errors = None - self.forward_protected_item_count = None - self.reverse_protected_item_count = None - - -class EnableMigrationInput(msrest.serialization.Model): - """Enable migration input. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Enable migration input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'EnableMigrationInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EnableMigrationInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class EnableMigrationInputProperties(msrest.serialization.Model): - """Enable migration input properties. - - All required parameters must be populated in order to send to Azure. - - :param policy_id: Required. The policy Id. - :type policy_id: str - :param provider_specific_details: Required. The provider specific details. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput - """ - - _validation = { - 'policy_id': {'required': True}, - 'provider_specific_details': {'required': True}, - } - - _attribute_map = { - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'EnableMigrationProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(EnableMigrationInputProperties, self).__init__(**kwargs) - self.policy_id = kwargs['policy_id'] - self.provider_specific_details = kwargs['provider_specific_details'] - - -class EnableMigrationProviderSpecificInput(msrest.serialization.Model): - """Enable migration provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtEnableMigrationInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtEnableMigrationInput'} - } - - def __init__( - self, - **kwargs - ): - super(EnableMigrationProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class EnableProtectionInput(msrest.serialization.Model): - """Enable protection input. - - :param properties: Enable protection input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'EnableProtectionInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EnableProtectionInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class EnableProtectionInputProperties(msrest.serialization.Model): - """Enable protection input properties. - - :param policy_id: The Policy Id. - :type policy_id: str - :param protectable_item_id: The protectable item Id. - :type protectable_item_id: str - :param provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure - provider, it will be AzureEnableProtectionInput object. For San provider, it will be - SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput - """ - - _attribute_map = { - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'protectable_item_id': {'key': 'protectableItemId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'EnableProtectionProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(EnableProtectionInputProperties, self).__init__(**kwargs) - self.policy_id = kwargs.get('policy_id', None) - self.protectable_item_id = kwargs.get('protectable_item_id', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class EncryptionDetails(msrest.serialization.Model): - """Encryption details for the fabric. - - :param kek_state: The key encryption key state for the Vmm. - :type kek_state: str - :param kek_cert_thumbprint: The key encryption key certificate thumbprint. - :type kek_cert_thumbprint: str - :param kek_cert_expiry_date: The key encryption key certificate expiry date. - :type kek_cert_expiry_date: ~datetime.datetime - """ - - _attribute_map = { - 'kek_state': {'key': 'kekState', 'type': 'str'}, - 'kek_cert_thumbprint': {'key': 'kekCertThumbprint', 'type': 'str'}, - 'kek_cert_expiry_date': {'key': 'kekCertExpiryDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionDetails, self).__init__(**kwargs) - self.kek_state = kwargs.get('kek_state', None) - self.kek_cert_thumbprint = kwargs.get('kek_cert_thumbprint', None) - self.kek_cert_expiry_date = kwargs.get('kek_cert_expiry_date', None) - - -class Event(Resource): - """Implements the Event class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Event related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.EventProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'EventProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Event, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class EventCollection(msrest.serialization.Model): - """Collection of fabric details. - - :param value: The list of events. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Event] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Event]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class EventProperties(msrest.serialization.Model): - """The properties of a monitoring event. - - :param event_code: The Id of the monitoring event. - :type event_code: str - :param description: The event name. - :type description: str - :param event_type: The type of the event. for example: VM Health, Server Health, Job Failure - etc. - :type event_type: str - :param affected_object_friendly_name: The friendly name of the source of the event on which it - is raised (for example, VM, VMM etc). - :type affected_object_friendly_name: str - :param affected_object_correlation_id: The affected object correlationId for the event. - :type affected_object_correlation_id: str - :param severity: The severity of the event. - :type severity: str - :param time_of_occurrence: The time of occurrence of the event. - :type time_of_occurrence: ~datetime.datetime - :param fabric_id: The ARM ID of the fabric. - :type fabric_id: str - :param provider_specific_details: The provider specific settings. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EventProviderSpecificDetails - :param event_specific_details: The event specific settings. - :type event_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EventSpecificDetails - :param health_errors: The list of errors / warnings capturing details associated with the - issue(s). - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _attribute_map = { - 'event_code': {'key': 'eventCode', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'event_type': {'key': 'eventType', 'type': 'str'}, - 'affected_object_friendly_name': {'key': 'affectedObjectFriendlyName', 'type': 'str'}, - 'affected_object_correlation_id': {'key': 'affectedObjectCorrelationId', 'type': 'str'}, - 'severity': {'key': 'severity', 'type': 'str'}, - 'time_of_occurrence': {'key': 'timeOfOccurrence', 'type': 'iso-8601'}, - 'fabric_id': {'key': 'fabricId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'EventProviderSpecificDetails'}, - 'event_specific_details': {'key': 'eventSpecificDetails', 'type': 'EventSpecificDetails'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - } - - def __init__( - self, - **kwargs - ): - super(EventProperties, self).__init__(**kwargs) - self.event_code = kwargs.get('event_code', None) - self.description = kwargs.get('description', None) - self.event_type = kwargs.get('event_type', None) - self.affected_object_friendly_name = kwargs.get('affected_object_friendly_name', None) - self.affected_object_correlation_id = kwargs.get('affected_object_correlation_id', None) - self.severity = kwargs.get('severity', None) - self.time_of_occurrence = kwargs.get('time_of_occurrence', None) - self.fabric_id = kwargs.get('fabric_id', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - self.event_specific_details = kwargs.get('event_specific_details', None) - self.health_errors = kwargs.get('health_errors', None) - - -class EventQueryParameter(msrest.serialization.Model): - """Implements the event query parameter. - - :param event_code: The source id of the events to be queried. - :type event_code: str - :param severity: The severity of the events to be queried. - :type severity: str - :param event_type: The type of the events to be queried. - :type event_type: str - :param fabric_name: The affected object server id of the events to be queried. - :type fabric_name: str - :param affected_object_friendly_name: The affected object name of the events to be queried. - :type affected_object_friendly_name: str - :param affected_object_correlation_id: The affected object correlationId for the events to be - queried. - :type affected_object_correlation_id: str - :param start_time: The start time of the time range within which the events are to be queried. - :type start_time: ~datetime.datetime - :param end_time: The end time of the time range within which the events are to be queried. - :type end_time: ~datetime.datetime - """ - - _attribute_map = { - 'event_code': {'key': 'eventCode', 'type': 'str'}, - 'severity': {'key': 'severity', 'type': 'str'}, - 'event_type': {'key': 'eventType', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'affected_object_friendly_name': {'key': 'affectedObjectFriendlyName', 'type': 'str'}, - 'affected_object_correlation_id': {'key': 'affectedObjectCorrelationId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EventQueryParameter, self).__init__(**kwargs) - self.event_code = kwargs.get('event_code', None) - self.severity = kwargs.get('severity', None) - self.event_type = kwargs.get('event_type', None) - self.fabric_name = kwargs.get('fabric_name', None) - self.affected_object_friendly_name = kwargs.get('affected_object_friendly_name', None) - self.affected_object_correlation_id = kwargs.get('affected_object_correlation_id', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - - -class EventSpecificDetails(msrest.serialization.Model): - """Model class for event specific details for an event. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JobStatusEventDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'JobStatus': 'JobStatusEventDetails'} - } - - def __init__( - self, - **kwargs - ): - super(EventSpecificDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class ProtectionProfileCustomDetails(msrest.serialization.Model): - """Protection Profile custom input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingProtectionProfile, NewProtectionProfile. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - } - - _subtype_map = { - 'resource_type': {'Existing': 'ExistingProtectionProfile', 'New': 'NewProtectionProfile'} - } - - def __init__( - self, - **kwargs - ): - super(ProtectionProfileCustomDetails, self).__init__(**kwargs) - self.resource_type = None # type: Optional[str] - - -class ExistingProtectionProfile(ProtectionProfileCustomDetails): - """Existing storage account input. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param protection_profile_id: Required. The protection profile Arm Id. Throw error, if resource - does not exists. - :type protection_profile_id: str - """ - - _validation = { - 'resource_type': {'required': True}, - 'protection_profile_id': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'protection_profile_id': {'key': 'protectionProfileId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExistingProtectionProfile, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str - self.protection_profile_id = kwargs['protection_profile_id'] - - -class RecoveryAvailabilitySetCustomDetails(msrest.serialization.Model): - """Recovery Availability Set custom input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingRecoveryAvailabilitySet. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - } - - _subtype_map = { - 'resource_type': {'Existing': 'ExistingRecoveryAvailabilitySet'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryAvailabilitySetCustomDetails, self).__init__(**kwargs) - self.resource_type = None # type: Optional[str] - - -class ExistingRecoveryAvailabilitySet(RecoveryAvailabilitySetCustomDetails): - """Existing recovery availability set input. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_availability_set_id: The recovery availability set Id. Will throw error, if - resource does not exist. - :type recovery_availability_set_id: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExistingRecoveryAvailabilitySet, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str - self.recovery_availability_set_id = kwargs.get('recovery_availability_set_id', None) - - -class RecoveryProximityPlacementGroupCustomDetails(msrest.serialization.Model): - """Recovery Proximity placement group custom input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingRecoveryProximityPlacementGroup. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - } - - _subtype_map = { - 'resource_type': {'Existing': 'ExistingRecoveryProximityPlacementGroup'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryProximityPlacementGroupCustomDetails, self).__init__(**kwargs) - self.resource_type = None # type: Optional[str] - - -class ExistingRecoveryProximityPlacementGroup(RecoveryProximityPlacementGroupCustomDetails): - """Existing recovery proximity placement group input. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. Will - throw error, if resource does not exist. - :type recovery_proximity_placement_group_id: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExistingRecoveryProximityPlacementGroup, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str - self.recovery_proximity_placement_group_id = kwargs.get('recovery_proximity_placement_group_id', None) - - -class RecoveryResourceGroupCustomDetails(msrest.serialization.Model): - """Recovery Resource Group custom input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingRecoveryResourceGroup. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - } - - _subtype_map = { - 'resource_type': {'Existing': 'ExistingRecoveryResourceGroup'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryResourceGroupCustomDetails, self).__init__(**kwargs) - self.resource_type = None # type: Optional[str] - - -class ExistingRecoveryResourceGroup(RecoveryResourceGroupCustomDetails): - """Existing recovery resource group input. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :type recovery_resource_group_id: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExistingRecoveryResourceGroup, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str - self.recovery_resource_group_id = kwargs.get('recovery_resource_group_id', None) - - -class RecoveryVirtualNetworkCustomDetails(msrest.serialization.Model): - """Recovery Virtual network custom input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingRecoveryVirtualNetwork, NewRecoveryVirtualNetwork. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - } - - _subtype_map = { - 'resource_type': {'Existing': 'ExistingRecoveryVirtualNetwork', 'New': 'NewRecoveryVirtualNetwork'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryVirtualNetworkCustomDetails, self).__init__(**kwargs) - self.resource_type = None # type: Optional[str] - - -class ExistingRecoveryVirtualNetwork(RecoveryVirtualNetworkCustomDetails): - """Existing recovery virtual network input. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_virtual_network_id: Required. The recovery virtual network Id. Will throw - error, if resource does not exist. - :type recovery_virtual_network_id: str - :param recovery_subnet_name: The recovery subnet name. - :type recovery_subnet_name: str - """ - - _validation = { - 'resource_type': {'required': True}, - 'recovery_virtual_network_id': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_virtual_network_id': {'key': 'recoveryVirtualNetworkId', 'type': 'str'}, - 'recovery_subnet_name': {'key': 'recoverySubnetName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExistingRecoveryVirtualNetwork, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str - self.recovery_virtual_network_id = kwargs['recovery_virtual_network_id'] - self.recovery_subnet_name = kwargs.get('recovery_subnet_name', None) - - -class StorageAccountCustomDetails(msrest.serialization.Model): - """Storage account custom input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingStorageAccount. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - } - - _subtype_map = { - 'resource_type': {'Existing': 'ExistingStorageAccount'} - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCustomDetails, self).__init__(**kwargs) - self.resource_type = None # type: Optional[str] - - -class ExistingStorageAccount(StorageAccountCustomDetails): - """Existing storage account input. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param azure_storage_account_id: Required. The storage account Arm Id. Throw error, if resource - does not exists. - :type azure_storage_account_id: str - """ - - _validation = { - 'resource_type': {'required': True}, - 'azure_storage_account_id': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'azure_storage_account_id': {'key': 'azureStorageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExistingStorageAccount, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str - self.azure_storage_account_id = kwargs['azure_storage_account_id'] - - -class ExportJobDetails(JobDetails): - """This class represents details for export jobs workflow. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - :param blob_uri: BlobUri of the exported jobs. - :type blob_uri: str - :param sas_token: The sas token to access blob. - :type sas_token: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - 'blob_uri': {'key': 'blobUri', 'type': 'str'}, - 'sas_token': {'key': 'sasToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportJobDetails, self).__init__(**kwargs) - self.instance_type = 'ExportJobDetails' # type: str - self.blob_uri = kwargs.get('blob_uri', None) - self.sas_token = kwargs.get('sas_token', None) - - -class Fabric(Resource): - """Fabric definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Fabric related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.FabricProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'FabricProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Fabric, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class FabricCollection(msrest.serialization.Model): - """Collection of fabric details. - - :param value: The fabric details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Fabric]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FabricCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class FabricCreationInput(msrest.serialization.Model): - """Site details provided during the time of site creation. - - :param properties: Fabric creation input. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'FabricCreationInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(FabricCreationInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class FabricCreationInputProperties(msrest.serialization.Model): - """Properties of site details provided during the time of site creation. - - :param custom_details: Fabric provider specific creation input. - :type custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreationInput - """ - - _attribute_map = { - 'custom_details': {'key': 'customDetails', 'type': 'FabricSpecificCreationInput'}, - } - - def __init__( - self, - **kwargs - ): - super(FabricCreationInputProperties, self).__init__(**kwargs) - self.custom_details = kwargs.get('custom_details', None) - - -class FabricProperties(msrest.serialization.Model): - """Fabric properties. - - :param friendly_name: Friendly name of the fabric. - :type friendly_name: str - :param encryption_details: Encryption details for the fabric. - :type encryption_details: ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails - :param rollover_encryption_details: Rollover encryption details for the fabric. - :type rollover_encryption_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails - :param internal_identifier: Dra Registration Id. - :type internal_identifier: str - :param bcdr_state: BCDR state of the fabric. - :type bcdr_state: str - :param custom_details: Fabric specific settings. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificDetails - :param health_error_details: Fabric health error details. - :type health_error_details: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param health: Health of fabric. - :type health: str - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'encryption_details': {'key': 'encryptionDetails', 'type': 'EncryptionDetails'}, - 'rollover_encryption_details': {'key': 'rolloverEncryptionDetails', 'type': 'EncryptionDetails'}, - 'internal_identifier': {'key': 'internalIdentifier', 'type': 'str'}, - 'bcdr_state': {'key': 'bcdrState', 'type': 'str'}, - 'custom_details': {'key': 'customDetails', 'type': 'FabricSpecificDetails'}, - 'health_error_details': {'key': 'healthErrorDetails', 'type': '[HealthError]'}, - 'health': {'key': 'health', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FabricProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.encryption_details = kwargs.get('encryption_details', None) - self.rollover_encryption_details = kwargs.get('rollover_encryption_details', None) - self.internal_identifier = kwargs.get('internal_identifier', None) - self.bcdr_state = kwargs.get('bcdr_state', None) - self.custom_details = kwargs.get('custom_details', None) - self.health_error_details = kwargs.get('health_error_details', None) - self.health = kwargs.get('health', None) - - -class FabricQueryParameter(msrest.serialization.Model): - """Query parameter to get fabric. - - :param zone_to_zone_mappings: A value indicating whether the zone to zone mappings are to be - returned. - :type zone_to_zone_mappings: str - :param fetch_agent_details: A value indicating whether the agent details are to be fetched. - :type fetch_agent_details: str - :param bios_id: The BIOS Id to be used for fetching agent details. - :type bios_id: str - :param fqdn: The FQDN to be used for fetching agent details. - :type fqdn: str - :param discovery_type: The type of the discovered machine to be used for fetching agent - details. - :type discovery_type: str - :param os_type: The OS type to be used for fetching agent details. - :type os_type: str - """ - - _attribute_map = { - 'zone_to_zone_mappings': {'key': 'zoneToZoneMappings', 'type': 'str'}, - 'fetch_agent_details': {'key': 'fetchAgentDetails', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FabricQueryParameter, self).__init__(**kwargs) - self.zone_to_zone_mappings = kwargs.get('zone_to_zone_mappings', None) - self.fetch_agent_details = kwargs.get('fetch_agent_details', None) - self.bios_id = kwargs.get('bios_id', None) - self.fqdn = kwargs.get('fqdn', None) - self.discovery_type = kwargs.get('discovery_type', None) - self.os_type = kwargs.get('os_type', None) - - -class JobTaskDetails(TaskTypeDetails): - """This class represents a task which is actually a workflow so that one can navigate to its individual drill down. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FabricReplicationGroupTaskDetails, VirtualMachineTaskDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param job_task: The job entity. - :type job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'job_task': {'key': 'jobTask', 'type': 'JobEntity'}, - } - - _subtype_map = { - 'instance_type': {'FabricReplicationGroupTaskDetails': 'FabricReplicationGroupTaskDetails', 'VirtualMachineTaskDetails': 'VirtualMachineTaskDetails'} - } - - def __init__( - self, - **kwargs - ): - super(JobTaskDetails, self).__init__(**kwargs) - self.instance_type = 'JobTaskDetails' # type: str - self.job_task = kwargs.get('job_task', None) - - -class FabricReplicationGroupTaskDetails(JobTaskDetails): - """This class represents the fabric replication group task details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param job_task: The job entity. - :type job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - :param skipped_reason: The skipped reason. - :type skipped_reason: str - :param skipped_reason_string: The skipped reason string. - :type skipped_reason_string: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'job_task': {'key': 'jobTask', 'type': 'JobEntity'}, - 'skipped_reason': {'key': 'skippedReason', 'type': 'str'}, - 'skipped_reason_string': {'key': 'skippedReasonString', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FabricReplicationGroupTaskDetails, self).__init__(**kwargs) - self.instance_type = 'FabricReplicationGroupTaskDetails' # type: str - self.skipped_reason = kwargs.get('skipped_reason', None) - self.skipped_reason_string = kwargs.get('skipped_reason_string', None) - - -class FailoverJobDetails(JobDetails): - """This class represents the details for a failover job. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - :param protected_item_details: The test VM details. - :type protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - 'protected_item_details': {'key': 'protectedItemDetails', 'type': '[FailoverReplicationProtectedItemDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(FailoverJobDetails, self).__init__(**kwargs) - self.instance_type = 'FailoverJobDetails' # type: str - self.protected_item_details = kwargs.get('protected_item_details', None) - - -class FailoverProcessServerRequest(msrest.serialization.Model): - """Request to failover a process server. - - :param properties: The properties of the PS Failover request. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequestProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'FailoverProcessServerRequestProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(FailoverProcessServerRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class FailoverProcessServerRequestProperties(msrest.serialization.Model): - """The properties of the Failover Process Server request. - - :param container_name: The container identifier. - :type container_name: str - :param source_process_server_id: The source process server. - :type source_process_server_id: str - :param target_process_server_id: The new process server. - :type target_process_server_id: str - :param vms_to_migrate: The VMS to migrate. - :type vms_to_migrate: list[str] - :param update_type: A value for failover type. It can be systemlevel/serverlevel. - :type update_type: str - """ - - _attribute_map = { - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_process_server_id': {'key': 'sourceProcessServerId', 'type': 'str'}, - 'target_process_server_id': {'key': 'targetProcessServerId', 'type': 'str'}, - 'vms_to_migrate': {'key': 'vmsToMigrate', 'type': '[str]'}, - 'update_type': {'key': 'updateType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FailoverProcessServerRequestProperties, self).__init__(**kwargs) - self.container_name = kwargs.get('container_name', None) - self.source_process_server_id = kwargs.get('source_process_server_id', None) - self.target_process_server_id = kwargs.get('target_process_server_id', None) - self.vms_to_migrate = kwargs.get('vms_to_migrate', None) - self.update_type = kwargs.get('update_type', None) - - -class FailoverReplicationProtectedItemDetails(msrest.serialization.Model): - """Failover details for a replication protected item. - - :param name: The name. - :type name: str - :param friendly_name: The friendly name. - :type friendly_name: str - :param test_vm_name: The test Vm name. - :type test_vm_name: str - :param test_vm_friendly_name: The test Vm friendly name. - :type test_vm_friendly_name: str - :param network_connection_status: The network connection status. - :type network_connection_status: str - :param network_friendly_name: The network friendly name. - :type network_friendly_name: str - :param subnet: The network subnet. - :type subnet: str - :param recovery_point_id: The recovery point Id. - :type recovery_point_id: str - :param recovery_point_time: The recovery point time. - :type recovery_point_time: ~datetime.datetime - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'test_vm_name': {'key': 'testVmName', 'type': 'str'}, - 'test_vm_friendly_name': {'key': 'testVmFriendlyName', 'type': 'str'}, - 'network_connection_status': {'key': 'networkConnectionStatus', 'type': 'str'}, - 'network_friendly_name': {'key': 'networkFriendlyName', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(FailoverReplicationProtectedItemDetails, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.test_vm_name = kwargs.get('test_vm_name', None) - self.test_vm_friendly_name = kwargs.get('test_vm_friendly_name', None) - self.network_connection_status = kwargs.get('network_connection_status', None) - self.network_friendly_name = kwargs.get('network_friendly_name', None) - self.subnet = kwargs.get('subnet', None) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - self.recovery_point_time = kwargs.get('recovery_point_time', None) - - -class GroupTaskDetails(msrest.serialization.Model): - """This class represents the group task details when parent child relationship exists in the drill down. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: InlineWorkflowTaskDetails, RecoveryPlanGroupTaskDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param child_tasks: The child tasks. - :type child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'child_tasks': {'key': 'childTasks', 'type': '[ASRTask]'}, - } - - _subtype_map = { - 'instance_type': {'InlineWorkflowTaskDetails': 'InlineWorkflowTaskDetails', 'RecoveryPlanGroupTaskDetails': 'RecoveryPlanGroupTaskDetails'} - } - - def __init__( - self, - **kwargs - ): - super(GroupTaskDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - self.child_tasks = kwargs.get('child_tasks', None) - - -class HealthError(msrest.serialization.Model): - """Health Error. - - :param inner_health_errors: The inner health errors. HealthError having a list of HealthError - as child errors is problematic. InnerHealthError is used because this will prevent an infinite - loop of structures when Hydra tries to auto-generate the contract. We are exposing the related - health errors as inner health errors and all API consumers can utilize this in the same fashion - as Exception -> InnerException. - :type inner_health_errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.InnerHealthError] - :param error_source: Source of error. - :type error_source: str - :param error_type: Type of error. - :type error_type: str - :param error_level: Level of error. - :type error_level: str - :param error_category: Category of error. - :type error_category: str - :param error_code: Error code. - :type error_code: str - :param summary_message: Summary message of the entity. - :type summary_message: str - :param error_message: Error message. - :type error_message: str - :param possible_causes: Possible causes of error. - :type possible_causes: str - :param recommended_action: Recommended action to resolve error. - :type recommended_action: str - :param creation_time_utc: Error creation time (UTC). - :type creation_time_utc: ~datetime.datetime - :param recovery_provider_error_message: DRA error message. - :type recovery_provider_error_message: str - :param entity_id: ID of the entity. - :type entity_id: str - :param error_id: The health error unique id. - :type error_id: str - :param customer_resolvability: Value indicating whether the health error is customer - resolvable. Possible values include: "Allowed", "NotAllowed". - :type customer_resolvability: str or - ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability - """ - - _attribute_map = { - 'inner_health_errors': {'key': 'innerHealthErrors', 'type': '[InnerHealthError]'}, - 'error_source': {'key': 'errorSource', 'type': 'str'}, - 'error_type': {'key': 'errorType', 'type': 'str'}, - 'error_level': {'key': 'errorLevel', 'type': 'str'}, - 'error_category': {'key': 'errorCategory', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'summary_message': {'key': 'summaryMessage', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'creation_time_utc': {'key': 'creationTimeUtc', 'type': 'iso-8601'}, - 'recovery_provider_error_message': {'key': 'recoveryProviderErrorMessage', 'type': 'str'}, - 'entity_id': {'key': 'entityId', 'type': 'str'}, - 'error_id': {'key': 'errorId', 'type': 'str'}, - 'customer_resolvability': {'key': 'customerResolvability', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HealthError, self).__init__(**kwargs) - self.inner_health_errors = kwargs.get('inner_health_errors', None) - self.error_source = kwargs.get('error_source', None) - self.error_type = kwargs.get('error_type', None) - self.error_level = kwargs.get('error_level', None) - self.error_category = kwargs.get('error_category', None) - self.error_code = kwargs.get('error_code', None) - self.summary_message = kwargs.get('summary_message', None) - self.error_message = kwargs.get('error_message', None) - self.possible_causes = kwargs.get('possible_causes', None) - self.recommended_action = kwargs.get('recommended_action', None) - self.creation_time_utc = kwargs.get('creation_time_utc', None) - self.recovery_provider_error_message = kwargs.get('recovery_provider_error_message', None) - self.entity_id = kwargs.get('entity_id', None) - self.error_id = kwargs.get('error_id', None) - self.customer_resolvability = kwargs.get('customer_resolvability', None) - - -class HealthErrorSummary(msrest.serialization.Model): - """class to define the summary of the health error details. - - :param summary_code: The code of the health error. - :type summary_code: str - :param category: The category of the health error. Possible values include: "None", - "Replication", "TestFailover", "Configuration", "FabricInfrastructure", "VersionExpiry", - "AgentAutoUpdateInfra", "AgentAutoUpdateArtifactDeleted", "AgentAutoUpdateRunAsAccount", - "AgentAutoUpdateRunAsAccountExpiry", "AgentAutoUpdateRunAsAccountExpired". - :type category: str or ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCategory - :param severity: Severity of error. Possible values include: "NONE", "Warning", "Error", - "Info". - :type severity: str or ~azure.mgmt.recoveryservicessiterecovery.models.Severity - :param summary_message: The summary message of the health error. - :type summary_message: str - :param affected_resource_type: The type of affected ARM resource. - :type affected_resource_type: str - :param affected_resource_subtype: The sub type of any subcomponent within the ARM resource that - this might be applicable. Value remains null if not applicable. - :type affected_resource_subtype: str - :param affected_resource_correlation_ids: The list of affected resource correlation Ids. This - can be used to uniquely identify the count of items affected by a specific category and - severity as well as count of item affected by an specific issue. - :type affected_resource_correlation_ids: list[str] - """ - - _attribute_map = { - 'summary_code': {'key': 'summaryCode', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'severity': {'key': 'severity', 'type': 'str'}, - 'summary_message': {'key': 'summaryMessage', 'type': 'str'}, - 'affected_resource_type': {'key': 'affectedResourceType', 'type': 'str'}, - 'affected_resource_subtype': {'key': 'affectedResourceSubtype', 'type': 'str'}, - 'affected_resource_correlation_ids': {'key': 'affectedResourceCorrelationIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(HealthErrorSummary, self).__init__(**kwargs) - self.summary_code = kwargs.get('summary_code', None) - self.category = kwargs.get('category', None) - self.severity = kwargs.get('severity', None) - self.summary_message = kwargs.get('summary_message', None) - self.affected_resource_type = kwargs.get('affected_resource_type', None) - self.affected_resource_subtype = kwargs.get('affected_resource_subtype', None) - self.affected_resource_correlation_ids = kwargs.get('affected_resource_correlation_ids', None) - - -class HyperVHostDetails(msrest.serialization.Model): - """Hyper-V host details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Hyper-V host Id. - :vartype id: str - :ivar name: The Hyper-V host name. - :vartype name: str - :ivar mars_agent_version: The Mars agent version. - :vartype mars_agent_version: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'mars_agent_version': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'mars_agent_version': {'key': 'marsAgentVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVHostDetails, self).__init__(**kwargs) - self.id = None - self.name = None - self.mars_agent_version = None - - -class HyperVReplica2012EventDetails(EventProviderSpecificDetails): - """Model class for event details of a HyperVReplica E2E event. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param container_name: The container friendly name. - :type container_name: str - :param fabric_name: The fabric friendly name. - :type fabric_name: str - :param remote_container_name: The remote container name. - :type remote_container_name: str - :param remote_fabric_name: The remote fabric name. - :type remote_fabric_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'remote_container_name': {'key': 'remoteContainerName', 'type': 'str'}, - 'remote_fabric_name': {'key': 'remoteFabricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplica2012EventDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012' # type: str - self.container_name = kwargs.get('container_name', None) - self.fabric_name = kwargs.get('fabric_name', None) - self.remote_container_name = kwargs.get('remote_container_name', None) - self.remote_fabric_name = kwargs.get('remote_fabric_name', None) - - -class HyperVReplica2012R2EventDetails(EventProviderSpecificDetails): - """Model class for event details of a HyperVReplica blue E2E event. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param container_name: The container friendly name. - :type container_name: str - :param fabric_name: The fabric friendly name. - :type fabric_name: str - :param remote_container_name: The remote container name. - :type remote_container_name: str - :param remote_fabric_name: The remote fabric name. - :type remote_fabric_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'remote_container_name': {'key': 'remoteContainerName', 'type': 'str'}, - 'remote_fabric_name': {'key': 'remoteFabricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplica2012R2EventDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012R2' # type: str - self.container_name = kwargs.get('container_name', None) - self.fabric_name = kwargs.get('fabric_name', None) - self.remote_container_name = kwargs.get('remote_container_name', None) - self.remote_fabric_name = kwargs.get('remote_fabric_name', None) - - -class HyperVReplicaAzureApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): - """ApplyRecoveryPoint input specific to HyperVReplicaAzure provider. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: The primary kek certificate pfx. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: The secondary kek certificate pfx. - :type secondary_kek_certificate_pfx: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.primary_kek_certificate_pfx = kwargs.get('primary_kek_certificate_pfx', None) - self.secondary_kek_certificate_pfx = kwargs.get('secondary_kek_certificate_pfx', None) - - -class HyperVReplicaAzureDiskInputDetails(msrest.serialization.Model): - """Disk input details. - - :param disk_id: The DiskId. - :type disk_id: str - :param log_storage_account_id: The LogStorageAccountId. - :type log_storage_account_id: str - :param disk_type: The DiskType. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :type disk_encryption_set_id: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureDiskInputDetails, self).__init__(**kwargs) - self.disk_id = kwargs.get('disk_id', None) - self.log_storage_account_id = kwargs.get('log_storage_account_id', None) - self.disk_type = kwargs.get('disk_type', None) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - - -class HyperVReplicaAzureEnableProtectionInput(EnableProtectionProviderSpecificInput): - """HyperVReplicaAzure specific enable protection input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param hv_host_vm_id: The Hyper-V host VM Id. - :type hv_host_vm_id: str - :param vm_name: The VM Name. - :type vm_name: str - :param os_type: The OS type associated with VM. - :type os_type: str - :param vhd_id: The OS disk VHD id associated with VM. - :type vhd_id: str - :param target_storage_account_id: The storage account Id. - :type target_storage_account_id: str - :param target_azure_network_id: The selected target Azure network Id. - :type target_azure_network_id: str - :param target_azure_subnet_id: The selected target Azure subnet Id. - :type target_azure_subnet_id: str - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param target_azure_vm_name: The target azure VM Name. - :type target_azure_vm_name: str - :param log_storage_account_id: The storage account to be used for logging during replication. - :type log_storage_account_id: str - :param disks_to_include: The list of VHD Ids of disks to be protected. - :type disks_to_include: list[str] - :param target_azure_v1_resource_group_id: The Id of the target resource group (for classic - deployment) in which the failover VM is to be created. - :type target_azure_v1_resource_group_id: str - :param target_azure_v2_resource_group_id: The Id of the target resource group (for resource - manager deployment) in which the failover VM is to be created. - :type target_azure_v2_resource_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during - failover. - :type use_managed_disks: str - :param target_availability_set_id: The target availability set ARM Id for resource manager - deployment. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param license_type: License type. Possible values include: "NotSpecified", "NoLicenseType", - "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_proximity_placement_group_id: The proximity placement group ARM Id. - :type target_proximity_placement_group_id: str - :param use_managed_disks_for_replication: A value indicating whether managed disks should be - used during replication. - :type use_managed_disks_for_replication: str - :param disk_type: The DiskType. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disks_to_include_for_managed_disks: The disks to include list for managed disks. - :type disks_to_include_for_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureDiskInputDetails] - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_managed_disk_tags: The tags for the seed managed disks. - :type seed_managed_disk_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'hv_host_vm_id': {'key': 'hvHostVmId', 'type': 'str'}, - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vhd_id': {'key': 'vhdId', 'type': 'str'}, - 'target_storage_account_id': {'key': 'targetStorageAccountId', 'type': 'str'}, - 'target_azure_network_id': {'key': 'targetAzureNetworkId', 'type': 'str'}, - 'target_azure_subnet_id': {'key': 'targetAzureSubnetId', 'type': 'str'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'target_azure_vm_name': {'key': 'targetAzureVmName', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[str]'}, - 'target_azure_v1_resource_group_id': {'key': 'targetAzureV1ResourceGroupId', 'type': 'str'}, - 'target_azure_v2_resource_group_id': {'key': 'targetAzureV2ResourceGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'use_managed_disks_for_replication': {'key': 'useManagedDisksForReplication', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disks_to_include_for_managed_disks': {'key': 'disksToIncludeForManagedDisks', 'type': '[HyperVReplicaAzureDiskInputDetails]'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_managed_disk_tags': {'key': 'seedManagedDiskTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.hv_host_vm_id = kwargs.get('hv_host_vm_id', None) - self.vm_name = kwargs.get('vm_name', None) - self.os_type = kwargs.get('os_type', None) - self.vhd_id = kwargs.get('vhd_id', None) - self.target_storage_account_id = kwargs.get('target_storage_account_id', None) - self.target_azure_network_id = kwargs.get('target_azure_network_id', None) - self.target_azure_subnet_id = kwargs.get('target_azure_subnet_id', None) - self.enable_rdp_on_target_option = kwargs.get('enable_rdp_on_target_option', None) - self.target_azure_vm_name = kwargs.get('target_azure_vm_name', None) - self.log_storage_account_id = kwargs.get('log_storage_account_id', None) - self.disks_to_include = kwargs.get('disks_to_include', None) - self.target_azure_v1_resource_group_id = kwargs.get('target_azure_v1_resource_group_id', None) - self.target_azure_v2_resource_group_id = kwargs.get('target_azure_v2_resource_group_id', None) - self.use_managed_disks = kwargs.get('use_managed_disks', None) - self.target_availability_set_id = kwargs.get('target_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.license_type = kwargs.get('license_type', None) - self.sql_server_license_type = kwargs.get('sql_server_license_type', None) - self.target_vm_size = kwargs.get('target_vm_size', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.use_managed_disks_for_replication = kwargs.get('use_managed_disks_for_replication', None) - self.disk_type = kwargs.get('disk_type', None) - self.disks_to_include_for_managed_disks = kwargs.get('disks_to_include_for_managed_disks', None) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.target_vm_tags = kwargs.get('target_vm_tags', None) - self.seed_managed_disk_tags = kwargs.get('seed_managed_disk_tags', None) - self.target_managed_disk_tags = kwargs.get('target_managed_disk_tags', None) - self.target_nic_tags = kwargs.get('target_nic_tags', None) - - -class HyperVReplicaAzureEventDetails(EventProviderSpecificDetails): - """Model class for event details of a HyperVReplica E2A event. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param container_name: The container friendly name. - :type container_name: str - :param fabric_name: The fabric friendly name. - :type fabric_name: str - :param remote_container_name: The remote container name. - :type remote_container_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'remote_container_name': {'key': 'remoteContainerName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureEventDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.container_name = kwargs.get('container_name', None) - self.fabric_name = kwargs.get('fabric_name', None) - self.remote_container_name = kwargs.get('remote_container_name', None) - - -class PlannedFailoverProviderSpecificFailoverInput(msrest.serialization.Model): - """Provider specific failover input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: HyperVReplicaAzurePlannedFailoverProviderInput, HyperVReplicaAzureFailbackProviderInput, InMageRcmFailbackPlannedFailoverProviderInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'HyperVReplicaAzure': 'HyperVReplicaAzurePlannedFailoverProviderInput', 'HyperVReplicaAzureFailback': 'HyperVReplicaAzureFailbackProviderInput', 'InMageRcmFailback': 'InMageRcmFailbackPlannedFailoverProviderInput'} - } - - def __init__( - self, - **kwargs - ): - super(PlannedFailoverProviderSpecificFailoverInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class HyperVReplicaAzureFailbackProviderInput(PlannedFailoverProviderSpecificFailoverInput): - """HyperVReplicaAzureFailback specific planned failover input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param data_sync_option: Data sync option. - :type data_sync_option: str - :param recovery_vm_creation_option: ALR options to create alternate recovery. - :type recovery_vm_creation_option: str - :param provider_id_for_alternate_recovery: Provider Id for alternate location. - :type provider_id_for_alternate_recovery: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'data_sync_option': {'key': 'dataSyncOption', 'type': 'str'}, - 'recovery_vm_creation_option': {'key': 'recoveryVmCreationOption', 'type': 'str'}, - 'provider_id_for_alternate_recovery': {'key': 'providerIdForAlternateRecovery', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureFailbackProviderInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzureFailback' # type: str - self.data_sync_option = kwargs.get('data_sync_option', None) - self.recovery_vm_creation_option = kwargs.get('recovery_vm_creation_option', None) - self.provider_id_for_alternate_recovery = kwargs.get('provider_id_for_alternate_recovery', None) - - -class HyperVReplicaAzureManagedDiskDetails(msrest.serialization.Model): - """Hyper-V Managed disk details. - - :param disk_id: The disk Id. - :type disk_id: str - :param seed_managed_disk_id: Seed managed disk Id. - :type seed_managed_disk_id: str - :param replica_disk_type: The replica disk type. - :type replica_disk_type: str - :param disk_encryption_set_id: The disk encryption set ARM Id. - :type disk_encryption_set_id: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'seed_managed_disk_id': {'key': 'seedManagedDiskId', 'type': 'str'}, - 'replica_disk_type': {'key': 'replicaDiskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureManagedDiskDetails, self).__init__(**kwargs) - self.disk_id = kwargs.get('disk_id', None) - self.seed_managed_disk_id = kwargs.get('seed_managed_disk_id', None) - self.replica_disk_type = kwargs.get('replica_disk_type', None) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - - -class HyperVReplicaAzurePlannedFailoverProviderInput(PlannedFailoverProviderSpecificFailoverInput): - """HyperVReplicaAzure specific planned failover input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: Primary kek certificate pfx. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :type secondary_kek_certificate_pfx: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzurePlannedFailoverProviderInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.primary_kek_certificate_pfx = kwargs.get('primary_kek_certificate_pfx', None) - self.secondary_kek_certificate_pfx = kwargs.get('secondary_kek_certificate_pfx', None) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - - -class HyperVReplicaAzurePolicyDetails(PolicyProviderSpecificDetails): - """Hyper-V Replica Azure specific protection profile details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_history_duration_in_hours: The duration (in hours) to which point the - recovery history needs to be maintained. - :type recovery_point_history_duration_in_hours: int - :param application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which - Hyper-V Replica should create an application consistent snapshot within the VM. - :type application_consistent_snapshot_frequency_in_hours: int - :param replication_interval: The replication interval. - :type replication_interval: int - :param online_replication_start_time: The scheduled start time for the initial replication. If - this parameter is Null, the initial replication starts immediately. - :type online_replication_start_time: str - :param encryption: A value indicating whether encryption is enabled for virtual machines in - this cloud. - :type encryption: str - :param active_storage_account_id: The active storage account Id. - :type active_storage_account_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_duration_in_hours': {'key': 'recoveryPointHistoryDurationInHours', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'replication_interval': {'key': 'replicationInterval', 'type': 'int'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'encryption': {'key': 'encryption', 'type': 'str'}, - 'active_storage_account_id': {'key': 'activeStorageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzurePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.recovery_point_history_duration_in_hours = kwargs.get('recovery_point_history_duration_in_hours', None) - self.application_consistent_snapshot_frequency_in_hours = kwargs.get('application_consistent_snapshot_frequency_in_hours', None) - self.replication_interval = kwargs.get('replication_interval', None) - self.online_replication_start_time = kwargs.get('online_replication_start_time', None) - self.encryption = kwargs.get('encryption', None) - self.active_storage_account_id = kwargs.get('active_storage_account_id', None) - - -class HyperVReplicaAzurePolicyInput(PolicyProviderSpecificInput): - """Hyper-V Replica Azure specific input for creating a protection profile. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_history_duration: The duration (in hours) to which point the recovery - history needs to be maintained. - :type recovery_point_history_duration: int - :param application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which - Hyper-V Replica should create an application consistent snapshot within the VM. - :type application_consistent_snapshot_frequency_in_hours: int - :param replication_interval: The replication interval. - :type replication_interval: int - :param online_replication_start_time: The scheduled start time for the initial replication. If - this parameter is Null, the initial replication starts immediately. - :type online_replication_start_time: str - :param storage_accounts: The list of storage accounts to which the VMs in the primary cloud can - replicate to. - :type storage_accounts: list[str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_duration': {'key': 'recoveryPointHistoryDuration', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'replication_interval': {'key': 'replicationInterval', 'type': 'int'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'storage_accounts': {'key': 'storageAccounts', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzurePolicyInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.recovery_point_history_duration = kwargs.get('recovery_point_history_duration', None) - self.application_consistent_snapshot_frequency_in_hours = kwargs.get('application_consistent_snapshot_frequency_in_hours', None) - self.replication_interval = kwargs.get('replication_interval', None) - self.online_replication_start_time = kwargs.get('online_replication_start_time', None) - self.storage_accounts = kwargs.get('storage_accounts', None) - - -class HyperVReplicaAzureReplicationDetails(ReplicationProviderSpecificSettings): - """Hyper V Replica Azure provider specific settings. - - 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. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param azure_vm_disk_details: Azure VM Disk details. - :type azure_vm_disk_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] - :param recovery_azure_vm_name: Recovery Azure given name. - :type recovery_azure_vm_name: str - :param recovery_azure_vm_size: The Recovery Azure VM size. - :type recovery_azure_vm_size: str - :param recovery_azure_storage_account: The recovery Azure storage account. - :type recovery_azure_storage_account: str - :param recovery_azure_log_storage_account_id: The ARM id of the log storage account used for - replication. This will be set to null if no log storage account was provided during enable - protection. - :type recovery_azure_log_storage_account_id: str - :param last_replicated_time: The Last replication time. - :type last_replicated_time: ~datetime.datetime - :param rpo_in_seconds: Last RPO value. - :type rpo_in_seconds: long - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param initial_replication_details: Initial replication details. - :type initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param selected_recovery_azure_network_id: The selected recovery azure network Id. - :type selected_recovery_azure_network_id: str - :param selected_source_nic_id: The selected source nic Id which will be used as the primary nic - during failover. - :type selected_source_nic_id: str - :param encryption: The encryption info. - :type encryption: str - :param o_s_details: The operating system info. - :type o_s_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :param source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :type source_vm_ram_size_in_mb: int - :param source_vm_cpu_count: The CPU count of the VM on the primary side. - :type source_vm_cpu_count: int - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param recovery_azure_resource_group_id: The target resource group Id. - :type recovery_azure_resource_group_id: str - :param recovery_availability_set_id: The recovery availability set Id. - :type recovery_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during - failover. - :type use_managed_disks: str - :param license_type: License Type of the VM to be used. - :type license_type: str - :param sql_server_license_type: The SQL Server license type. - :type sql_server_license_type: str - :ivar last_recovery_point_received: The last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_managed_disk_tags: The tags for the seed managed disks. - :type seed_managed_disk_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - :param protected_managed_disks: The list of protected managed disks. - :type protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureManagedDiskDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - 'last_recovery_point_received': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'azure_vm_disk_details': {'key': 'azureVmDiskDetails', 'type': '[AzureVmDiskDetails]'}, - 'recovery_azure_vm_name': {'key': 'recoveryAzureVmName', 'type': 'str'}, - 'recovery_azure_vm_size': {'key': 'recoveryAzureVMSize', 'type': 'str'}, - 'recovery_azure_storage_account': {'key': 'recoveryAzureStorageAccount', 'type': 'str'}, - 'recovery_azure_log_storage_account_id': {'key': 'recoveryAzureLogStorageAccountId', 'type': 'str'}, - 'last_replicated_time': {'key': 'lastReplicatedTime', 'type': 'iso-8601'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'initial_replication_details': {'key': 'initialReplicationDetails', 'type': 'InitialReplicationDetails'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'selected_recovery_azure_network_id': {'key': 'selectedRecoveryAzureNetworkId', 'type': 'str'}, - 'selected_source_nic_id': {'key': 'selectedSourceNicId', 'type': 'str'}, - 'encryption': {'key': 'encryption', 'type': 'str'}, - 'o_s_details': {'key': 'oSDetails', 'type': 'OSDetails'}, - 'source_vm_ram_size_in_mb': {'key': 'sourceVmRamSizeInMB', 'type': 'int'}, - 'source_vm_cpu_count': {'key': 'sourceVmCpuCount', 'type': 'int'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'recovery_azure_resource_group_id': {'key': 'recoveryAzureResourceGroupId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'last_recovery_point_received': {'key': 'lastRecoveryPointReceived', 'type': 'iso-8601'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_managed_disk_tags': {'key': 'seedManagedDiskTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - 'protected_managed_disks': {'key': 'protectedManagedDisks', 'type': '[HyperVReplicaAzureManagedDiskDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.azure_vm_disk_details = kwargs.get('azure_vm_disk_details', None) - self.recovery_azure_vm_name = kwargs.get('recovery_azure_vm_name', None) - self.recovery_azure_vm_size = kwargs.get('recovery_azure_vm_size', None) - self.recovery_azure_storage_account = kwargs.get('recovery_azure_storage_account', None) - self.recovery_azure_log_storage_account_id = kwargs.get('recovery_azure_log_storage_account_id', None) - self.last_replicated_time = kwargs.get('last_replicated_time', None) - self.rpo_in_seconds = kwargs.get('rpo_in_seconds', None) - self.last_rpo_calculated_time = kwargs.get('last_rpo_calculated_time', None) - self.vm_id = kwargs.get('vm_id', None) - self.vm_protection_state = kwargs.get('vm_protection_state', None) - self.vm_protection_state_description = kwargs.get('vm_protection_state_description', None) - self.initial_replication_details = kwargs.get('initial_replication_details', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.selected_recovery_azure_network_id = kwargs.get('selected_recovery_azure_network_id', None) - self.selected_source_nic_id = kwargs.get('selected_source_nic_id', None) - self.encryption = kwargs.get('encryption', None) - self.o_s_details = kwargs.get('o_s_details', None) - self.source_vm_ram_size_in_mb = kwargs.get('source_vm_ram_size_in_mb', None) - self.source_vm_cpu_count = kwargs.get('source_vm_cpu_count', None) - self.enable_rdp_on_target_option = kwargs.get('enable_rdp_on_target_option', None) - self.recovery_azure_resource_group_id = kwargs.get('recovery_azure_resource_group_id', None) - self.recovery_availability_set_id = kwargs.get('recovery_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.use_managed_disks = kwargs.get('use_managed_disks', None) - self.license_type = kwargs.get('license_type', None) - self.sql_server_license_type = kwargs.get('sql_server_license_type', None) - self.last_recovery_point_received = None - self.target_vm_tags = kwargs.get('target_vm_tags', None) - self.seed_managed_disk_tags = kwargs.get('seed_managed_disk_tags', None) - self.target_managed_disk_tags = kwargs.get('target_managed_disk_tags', None) - self.target_nic_tags = kwargs.get('target_nic_tags', None) - self.protected_managed_disks = kwargs.get('protected_managed_disks', None) - - -class HyperVReplicaAzureReprotectInput(ReverseReplicationProviderSpecificInput): - """Azure specific reprotect input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param hv_host_vm_id: The Hyper-V host Vm Id. - :type hv_host_vm_id: str - :param vm_name: The Vm Name. - :type vm_name: str - :param os_type: The OS type associated with vm. - :type os_type: str - :param v_hd_id: The OS disk VHD id associated with vm. - :type v_hd_id: str - :param storage_account_id: The storage account name. - :type storage_account_id: str - :param log_storage_account_id: The storage account to be used for logging during replication. - :type log_storage_account_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'hv_host_vm_id': {'key': 'hvHostVmId', 'type': 'str'}, - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'v_hd_id': {'key': 'vHDId', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureReprotectInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.hv_host_vm_id = kwargs.get('hv_host_vm_id', None) - self.vm_name = kwargs.get('vm_name', None) - self.os_type = kwargs.get('os_type', None) - self.v_hd_id = kwargs.get('v_hd_id', None) - self.storage_account_id = kwargs.get('storage_account_id', None) - self.log_storage_account_id = kwargs.get('log_storage_account_id', None) - - -class HyperVReplicaAzureTestFailoverInput(TestFailoverProviderSpecificInput): - """HvrA provider specific input for test failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: Primary kek certificate pfx. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :type secondary_kek_certificate_pfx: str - :param recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureTestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.primary_kek_certificate_pfx = kwargs.get('primary_kek_certificate_pfx', None) - self.secondary_kek_certificate_pfx = kwargs.get('secondary_kek_certificate_pfx', None) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - - -class HyperVReplicaAzureUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """HvrA provider specific input for unplanned failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: Primary kek certificate pfx. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :type secondary_kek_certificate_pfx: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureUnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.primary_kek_certificate_pfx = kwargs.get('primary_kek_certificate_pfx', None) - self.secondary_kek_certificate_pfx = kwargs.get('secondary_kek_certificate_pfx', None) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - - -class HyperVReplicaAzureUpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProviderInput): - """HyperV replica Azure input to update replication protected item. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic - deployment. - :type recovery_azure_v1_resource_group_id: str - :param recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource - manager deployment. - :type recovery_azure_v2_resource_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during - failover. - :type use_managed_disks: str - :param disk_id_to_disk_encryption_map: The dictionary of disk resource Id to disk encryption - set ARM Id. - :type disk_id_to_disk_encryption_map: dict[str, str] - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param vm_disks: The list of disk update properties. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_azure_v1_resource_group_id': {'key': 'recoveryAzureV1ResourceGroupId', 'type': 'str'}, - 'recovery_azure_v2_resource_group_id': {'key': 'recoveryAzureV2ResourceGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'disk_id_to_disk_encryption_map': {'key': 'diskIdToDiskEncryptionMap', 'type': '{str}'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[UpdateDiskInput]'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaAzureUpdateReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.recovery_azure_v1_resource_group_id = kwargs.get('recovery_azure_v1_resource_group_id', None) - self.recovery_azure_v2_resource_group_id = kwargs.get('recovery_azure_v2_resource_group_id', None) - self.use_managed_disks = kwargs.get('use_managed_disks', None) - self.disk_id_to_disk_encryption_map = kwargs.get('disk_id_to_disk_encryption_map', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_vm_tags = kwargs.get('target_vm_tags', None) - self.target_managed_disk_tags = kwargs.get('target_managed_disk_tags', None) - self.target_nic_tags = kwargs.get('target_nic_tags', None) - self.sql_server_license_type = kwargs.get('sql_server_license_type', None) - self.vm_disks = kwargs.get('vm_disks', None) - - -class HyperVReplicaBaseEventDetails(EventProviderSpecificDetails): - """Abstract model class for event details of a HyperVReplica E2E event. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param container_name: The container friendly name. - :type container_name: str - :param fabric_name: The fabric friendly name. - :type fabric_name: str - :param remote_container_name: The remote container name. - :type remote_container_name: str - :param remote_fabric_name: The remote fabric name. - :type remote_fabric_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'remote_container_name': {'key': 'remoteContainerName', 'type': 'str'}, - 'remote_fabric_name': {'key': 'remoteFabricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaBaseEventDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaBaseEventDetails' # type: str - self.container_name = kwargs.get('container_name', None) - self.fabric_name = kwargs.get('fabric_name', None) - self.remote_container_name = kwargs.get('remote_container_name', None) - self.remote_fabric_name = kwargs.get('remote_fabric_name', None) - - -class HyperVReplicaBasePolicyDetails(PolicyProviderSpecificDetails): - """Base class for HyperVReplica policy details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion_option: A value indicating whether the VM has to be auto deleted. - Supported Values: String.Empty, None, OnRecoveryCloud. - :type replica_deletion_option: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion_option': {'key': 'replicaDeletionOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaBasePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaBasePolicyDetails' # type: str - self.recovery_points = kwargs.get('recovery_points', None) - self.application_consistent_snapshot_frequency_in_hours = kwargs.get('application_consistent_snapshot_frequency_in_hours', None) - self.compression = kwargs.get('compression', None) - self.initial_replication_method = kwargs.get('initial_replication_method', None) - self.online_replication_start_time = kwargs.get('online_replication_start_time', None) - self.offline_replication_import_path = kwargs.get('offline_replication_import_path', None) - self.offline_replication_export_path = kwargs.get('offline_replication_export_path', None) - self.replication_port = kwargs.get('replication_port', None) - self.allowed_authentication_type = kwargs.get('allowed_authentication_type', None) - self.replica_deletion_option = kwargs.get('replica_deletion_option', None) - - -class HyperVReplicaBaseReplicationDetails(ReplicationProviderSpecificSettings): - """Hyper V replica provider specific settings base class. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param last_replicated_time: The Last replication time. - :type last_replicated_time: ~datetime.datetime - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param initial_replication_details: Initial replication details. - :type initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param v_m_disk_details: VM disk details. - :type v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'last_replicated_time': {'key': 'lastReplicatedTime', 'type': 'iso-8601'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'initial_replication_details': {'key': 'initialReplicationDetails', 'type': 'InitialReplicationDetails'}, - 'v_m_disk_details': {'key': 'vMDiskDetails', 'type': '[DiskDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaBaseReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaBaseReplicationDetails' # type: str - self.last_replicated_time = kwargs.get('last_replicated_time', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.vm_id = kwargs.get('vm_id', None) - self.vm_protection_state = kwargs.get('vm_protection_state', None) - self.vm_protection_state_description = kwargs.get('vm_protection_state_description', None) - self.initial_replication_details = kwargs.get('initial_replication_details', None) - self.v_m_disk_details = kwargs.get('v_m_disk_details', None) - - -class HyperVReplicaBluePolicyDetails(PolicyProviderSpecificDetails): - """Hyper-V Replica Blue specific protection profile details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param replication_frequency_in_seconds: A value indicating the replication interval. - :type replication_frequency_in_seconds: int - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion_option: A value indicating whether the VM has to be auto deleted. - Supported Values: String.Empty, None, OnRecoveryCloud. - :type replica_deletion_option: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'replication_frequency_in_seconds': {'key': 'replicationFrequencyInSeconds', 'type': 'int'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion_option': {'key': 'replicaDeletionOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaBluePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012R2' # type: str - self.replication_frequency_in_seconds = kwargs.get('replication_frequency_in_seconds', None) - self.recovery_points = kwargs.get('recovery_points', None) - self.application_consistent_snapshot_frequency_in_hours = kwargs.get('application_consistent_snapshot_frequency_in_hours', None) - self.compression = kwargs.get('compression', None) - self.initial_replication_method = kwargs.get('initial_replication_method', None) - self.online_replication_start_time = kwargs.get('online_replication_start_time', None) - self.offline_replication_import_path = kwargs.get('offline_replication_import_path', None) - self.offline_replication_export_path = kwargs.get('offline_replication_export_path', None) - self.replication_port = kwargs.get('replication_port', None) - self.allowed_authentication_type = kwargs.get('allowed_authentication_type', None) - self.replica_deletion_option = kwargs.get('replica_deletion_option', None) - - -class HyperVReplicaPolicyInput(PolicyProviderSpecificInput): - """Hyper-V Replica specific policy Input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: HyperVReplicaBluePolicyInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion: A value indicating whether the VM has to be auto deleted. - :type replica_deletion: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion': {'key': 'replicaDeletion', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'HyperVReplica2012R2': 'HyperVReplicaBluePolicyInput'} - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaPolicyInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012' # type: str - self.recovery_points = kwargs.get('recovery_points', None) - self.application_consistent_snapshot_frequency_in_hours = kwargs.get('application_consistent_snapshot_frequency_in_hours', None) - self.compression = kwargs.get('compression', None) - self.initial_replication_method = kwargs.get('initial_replication_method', None) - self.online_replication_start_time = kwargs.get('online_replication_start_time', None) - self.offline_replication_import_path = kwargs.get('offline_replication_import_path', None) - self.offline_replication_export_path = kwargs.get('offline_replication_export_path', None) - self.replication_port = kwargs.get('replication_port', None) - self.allowed_authentication_type = kwargs.get('allowed_authentication_type', None) - self.replica_deletion = kwargs.get('replica_deletion', None) - - -class HyperVReplicaBluePolicyInput(HyperVReplicaPolicyInput): - """HyperV Replica Blue policy input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion: A value indicating whether the VM has to be auto deleted. - :type replica_deletion: str - :param replication_frequency_in_seconds: A value indicating the replication interval. - :type replication_frequency_in_seconds: int - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion': {'key': 'replicaDeletion', 'type': 'str'}, - 'replication_frequency_in_seconds': {'key': 'replicationFrequencyInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaBluePolicyInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012R2' # type: str - self.replication_frequency_in_seconds = kwargs.get('replication_frequency_in_seconds', None) - - -class HyperVReplicaBlueReplicationDetails(ReplicationProviderSpecificSettings): - """HyperV replica 2012 R2 (Blue) replication details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param last_replicated_time: The Last replication time. - :type last_replicated_time: ~datetime.datetime - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param initial_replication_details: Initial replication details. - :type initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param v_m_disk_details: VM disk details. - :type v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'last_replicated_time': {'key': 'lastReplicatedTime', 'type': 'iso-8601'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'initial_replication_details': {'key': 'initialReplicationDetails', 'type': 'InitialReplicationDetails'}, - 'v_m_disk_details': {'key': 'vMDiskDetails', 'type': '[DiskDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaBlueReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012R2' # type: str - self.last_replicated_time = kwargs.get('last_replicated_time', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.vm_id = kwargs.get('vm_id', None) - self.vm_protection_state = kwargs.get('vm_protection_state', None) - self.vm_protection_state_description = kwargs.get('vm_protection_state_description', None) - self.initial_replication_details = kwargs.get('initial_replication_details', None) - self.v_m_disk_details = kwargs.get('v_m_disk_details', None) - - -class HyperVReplicaPolicyDetails(PolicyProviderSpecificDetails): - """Hyper-V Replica Blue specific protection profile details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion_option: A value indicating whether the VM has to be auto deleted. - Supported Values: String.Empty, None, OnRecoveryCloud. - :type replica_deletion_option: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion_option': {'key': 'replicaDeletionOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaPolicyDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012' # type: str - self.recovery_points = kwargs.get('recovery_points', None) - self.application_consistent_snapshot_frequency_in_hours = kwargs.get('application_consistent_snapshot_frequency_in_hours', None) - self.compression = kwargs.get('compression', None) - self.initial_replication_method = kwargs.get('initial_replication_method', None) - self.online_replication_start_time = kwargs.get('online_replication_start_time', None) - self.offline_replication_import_path = kwargs.get('offline_replication_import_path', None) - self.offline_replication_export_path = kwargs.get('offline_replication_export_path', None) - self.replication_port = kwargs.get('replication_port', None) - self.allowed_authentication_type = kwargs.get('allowed_authentication_type', None) - self.replica_deletion_option = kwargs.get('replica_deletion_option', None) - - -class HyperVReplicaReplicationDetails(ReplicationProviderSpecificSettings): - """HyperV replica 2012 replication details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param last_replicated_time: The Last replication time. - :type last_replicated_time: ~datetime.datetime - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param initial_replication_details: Initial replication details. - :type initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param v_m_disk_details: VM disk details. - :type v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'last_replicated_time': {'key': 'lastReplicatedTime', 'type': 'iso-8601'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'initial_replication_details': {'key': 'initialReplicationDetails', 'type': 'InitialReplicationDetails'}, - 'v_m_disk_details': {'key': 'vMDiskDetails', 'type': '[DiskDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVReplicaReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012' # type: str - self.last_replicated_time = kwargs.get('last_replicated_time', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.vm_id = kwargs.get('vm_id', None) - self.vm_protection_state = kwargs.get('vm_protection_state', None) - self.vm_protection_state_description = kwargs.get('vm_protection_state_description', None) - self.initial_replication_details = kwargs.get('initial_replication_details', None) - self.v_m_disk_details = kwargs.get('v_m_disk_details', None) - - -class HyperVSiteDetails(FabricSpecificDetails): - """HyperVSite fabric specific details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param hyper_v_hosts: The list of Hyper-V hosts associated with the fabric. - :type hyper_v_hosts: list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVHostDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'hyper_v_hosts': {'key': 'hyperVHosts', 'type': '[HyperVHostDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(HyperVSiteDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVSite' # type: str - self.hyper_v_hosts = kwargs.get('hyper_v_hosts', None) - - -class HyperVVirtualMachineDetails(ConfigurationSettings): - """Single Host fabric provider specific VM settings. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VmmVirtualMachineDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param source_item_id: The source id of the object. - :type source_item_id: str - :param generation: The id of the object in fabric. - :type generation: str - :param os_details: The Last replication time. - :type os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :param disk_details: The Last successful failover time. - :type disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - :param has_physical_disk: A value indicating whether the VM has a physical disk attached. - String value of SrsDataContract.PresenceStatus enum. Possible values include: "Unknown", - "Present", "NotPresent". - :type has_physical_disk: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :param has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter - attached. String value of SrsDataContract.PresenceStatus enum. Possible values include: - "Unknown", "Present", "NotPresent". - :type has_fibre_channel_adapter: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :param has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String - value of SrsDataContract.PresenceStatus enum. Possible values include: "Unknown", "Present", - "NotPresent". - :type has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'source_item_id': {'key': 'sourceItemId', 'type': 'str'}, - 'generation': {'key': 'generation', 'type': 'str'}, - 'os_details': {'key': 'osDetails', 'type': 'OSDetails'}, - 'disk_details': {'key': 'diskDetails', 'type': '[DiskDetails]'}, - 'has_physical_disk': {'key': 'hasPhysicalDisk', 'type': 'str'}, - 'has_fibre_channel_adapter': {'key': 'hasFibreChannelAdapter', 'type': 'str'}, - 'has_shared_vhd': {'key': 'hasSharedVhd', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'VmmVirtualMachine': 'VmmVirtualMachineDetails'} - } - - def __init__( - self, - **kwargs - ): - super(HyperVVirtualMachineDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVVirtualMachine' # type: str - self.source_item_id = kwargs.get('source_item_id', None) - self.generation = kwargs.get('generation', None) - self.os_details = kwargs.get('os_details', None) - self.disk_details = kwargs.get('disk_details', None) - self.has_physical_disk = kwargs.get('has_physical_disk', None) - self.has_fibre_channel_adapter = kwargs.get('has_fibre_channel_adapter', None) - self.has_shared_vhd = kwargs.get('has_shared_vhd', None) - - -class IdentityProviderDetails(msrest.serialization.Model): - """Identity provider details. - - :param tenant_id: The tenant Id for the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :type tenant_id: str - :param application_id: The application/client Id for the service principal with which the - on-premise management/data plane components would communicate with our Azure services. - :type application_id: str - :param object_id: The object Id of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :type object_id: str - :param audience: The intended Audience of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :type audience: str - :param aad_authority: The base authority for Azure Active Directory authentication. - :type aad_authority: str - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'application_id': {'key': 'applicationId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityProviderDetails, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.application_id = kwargs.get('application_id', None) - self.object_id = kwargs.get('object_id', None) - self.audience = kwargs.get('audience', None) - self.aad_authority = kwargs.get('aad_authority', None) - - -class IdentityProviderInput(msrest.serialization.Model): - """Identity provider input. - - All required parameters must be populated in order to send to Azure. - - :param tenant_id: Required. The tenant Id for the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :type tenant_id: str - :param application_id: Required. The application/client Id for the service principal with which - the on-premise management/data plane components would communicate with our Azure services. - :type application_id: str - :param object_id: Required. The object Id of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :type object_id: str - :param audience: Required. The intended Audience of the service principal with which the - on-premise management/data plane components would communicate with our Azure services. - :type audience: str - :param aad_authority: Required. The base authority for Azure Active Directory authentication. - :type aad_authority: str - """ - - _validation = { - 'tenant_id': {'required': True}, - 'application_id': {'required': True}, - 'object_id': {'required': True}, - 'audience': {'required': True}, - 'aad_authority': {'required': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'application_id': {'key': 'applicationId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityProviderInput, self).__init__(**kwargs) - self.tenant_id = kwargs['tenant_id'] - self.application_id = kwargs['application_id'] - self.object_id = kwargs['object_id'] - self.audience = kwargs['audience'] - self.aad_authority = kwargs['aad_authority'] - - -class InconsistentVmDetails(msrest.serialization.Model): - """This class stores the monitoring details for consistency check of inconsistent Protected Entity. - - :param vm_name: The Vm name. - :type vm_name: str - :param cloud_name: The Cloud name. - :type cloud_name: str - :param details: The list of details regarding state of the Protected Entity in SRS and On prem. - :type details: list[str] - :param error_ids: The list of error ids. - :type error_ids: list[str] - """ - - _attribute_map = { - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'cloud_name': {'key': 'cloudName', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[str]'}, - 'error_ids': {'key': 'errorIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(InconsistentVmDetails, self).__init__(**kwargs) - self.vm_name = kwargs.get('vm_name', None) - self.cloud_name = kwargs.get('cloud_name', None) - self.details = kwargs.get('details', None) - self.error_ids = kwargs.get('error_ids', None) - - -class InitialReplicationDetails(msrest.serialization.Model): - """Initial replication details. - - :param initial_replication_type: Initial replication type. - :type initial_replication_type: str - :param initial_replication_progress_percentage: The initial replication progress percentage. - :type initial_replication_progress_percentage: str - """ - - _attribute_map = { - 'initial_replication_type': {'key': 'initialReplicationType', 'type': 'str'}, - 'initial_replication_progress_percentage': {'key': 'initialReplicationProgressPercentage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InitialReplicationDetails, self).__init__(**kwargs) - self.initial_replication_type = kwargs.get('initial_replication_type', None) - self.initial_replication_progress_percentage = kwargs.get('initial_replication_progress_percentage', None) - - -class InlineWorkflowTaskDetails(GroupTaskDetails): - """This class represents the inline workflow task details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param child_tasks: The child tasks. - :type child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :param workflow_ids: The list of child workflow ids. - :type workflow_ids: list[str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'child_tasks': {'key': 'childTasks', 'type': '[ASRTask]'}, - 'workflow_ids': {'key': 'workflowIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(InlineWorkflowTaskDetails, self).__init__(**kwargs) - self.instance_type = 'InlineWorkflowTaskDetails' # type: str - self.workflow_ids = kwargs.get('workflow_ids', None) - - -class InMageAgentDetails(msrest.serialization.Model): - """The details of the InMage agent. - - :param agent_version: The agent version. - :type agent_version: str - :param agent_update_status: A value indicating whether installed agent needs to be updated. - :type agent_update_status: str - :param post_update_reboot_status: A value indicating whether reboot is required after update is - applied. - :type post_update_reboot_status: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - """ - - _attribute_map = { - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'agent_update_status': {'key': 'agentUpdateStatus', 'type': 'str'}, - 'post_update_reboot_status': {'key': 'postUpdateRebootStatus', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAgentDetails, self).__init__(**kwargs) - self.agent_version = kwargs.get('agent_version', None) - self.agent_update_status = kwargs.get('agent_update_status', None) - self.post_update_reboot_status = kwargs.get('post_update_reboot_status', None) - self.agent_expiry_date = kwargs.get('agent_expiry_date', None) - - -class InMageAzureV2ApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): - """ApplyRecoveryPoint input specific to InMageAzureV2 provider. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2ApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - - -class InMageAzureV2DiskInputDetails(msrest.serialization.Model): - """Disk input details. - - :param disk_id: The DiskId. - :type disk_id: str - :param log_storage_account_id: The LogStorageAccountId. - :type log_storage_account_id: str - :param disk_type: The DiskType. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :type disk_encryption_set_id: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2DiskInputDetails, self).__init__(**kwargs) - self.disk_id = kwargs.get('disk_id', None) - self.log_storage_account_id = kwargs.get('log_storage_account_id', None) - self.disk_type = kwargs.get('disk_type', None) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - - -class InMageAzureV2EnableProtectionInput(EnableProtectionProviderSpecificInput): - """VMware Azure specific enable protection input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param master_target_id: The Master target Id. - :type master_target_id: str - :param process_server_id: The Process Server Id. - :type process_server_id: str - :param storage_account_id: The storage account Id. - :type storage_account_id: str - :param run_as_account_id: The CS account Id. - :type run_as_account_id: str - :param multi_vm_group_id: The multi VM group Id. - :type multi_vm_group_id: str - :param multi_vm_group_name: The multi VM group name. - :type multi_vm_group_name: str - :param disks_to_include: The disks to include list. - :type disks_to_include: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2DiskInputDetails] - :param target_azure_network_id: The selected target Azure network Id. - :type target_azure_network_id: str - :param target_azure_subnet_id: The selected target Azure subnet Id. - :type target_azure_subnet_id: str - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target VM after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param target_azure_vm_name: The target azure VM Name. - :type target_azure_vm_name: str - :param log_storage_account_id: The storage account to be used for logging during replication. - :type log_storage_account_id: str - :param target_azure_v1_resource_group_id: The Id of the target resource group (for classic - deployment) in which the failover VM is to be created. - :type target_azure_v1_resource_group_id: str - :param target_azure_v2_resource_group_id: The Id of the target resource group (for resource - manager deployment) in which the failover VM is to be created. - :type target_azure_v2_resource_group_id: str - :param disk_type: The DiskType. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param target_availability_set_id: The target availability set ARM Id for resource manager - deployment. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The proximity placement group ARM Id. - :type target_proximity_placement_group_id: str - :param license_type: License type. Possible values include: "NotSpecified", "NoLicenseType", - "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_managed_disk_tags: The tags for the seed managed disks. - :type seed_managed_disk_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[InMageAzureV2DiskInputDetails]'}, - 'target_azure_network_id': {'key': 'targetAzureNetworkId', 'type': 'str'}, - 'target_azure_subnet_id': {'key': 'targetAzureSubnetId', 'type': 'str'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'target_azure_vm_name': {'key': 'targetAzureVmName', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'target_azure_v1_resource_group_id': {'key': 'targetAzureV1ResourceGroupId', 'type': 'str'}, - 'target_azure_v2_resource_group_id': {'key': 'targetAzureV2ResourceGroupId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_managed_disk_tags': {'key': 'seedManagedDiskTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2EnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.master_target_id = kwargs.get('master_target_id', None) - self.process_server_id = kwargs.get('process_server_id', None) - self.storage_account_id = kwargs.get('storage_account_id', None) - self.run_as_account_id = kwargs.get('run_as_account_id', None) - self.multi_vm_group_id = kwargs.get('multi_vm_group_id', None) - self.multi_vm_group_name = kwargs.get('multi_vm_group_name', None) - self.disks_to_include = kwargs.get('disks_to_include', None) - self.target_azure_network_id = kwargs.get('target_azure_network_id', None) - self.target_azure_subnet_id = kwargs.get('target_azure_subnet_id', None) - self.enable_rdp_on_target_option = kwargs.get('enable_rdp_on_target_option', None) - self.target_azure_vm_name = kwargs.get('target_azure_vm_name', None) - self.log_storage_account_id = kwargs.get('log_storage_account_id', None) - self.target_azure_v1_resource_group_id = kwargs.get('target_azure_v1_resource_group_id', None) - self.target_azure_v2_resource_group_id = kwargs.get('target_azure_v2_resource_group_id', None) - self.disk_type = kwargs.get('disk_type', None) - self.target_availability_set_id = kwargs.get('target_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.license_type = kwargs.get('license_type', None) - self.sql_server_license_type = kwargs.get('sql_server_license_type', None) - self.target_vm_size = kwargs.get('target_vm_size', None) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.target_vm_tags = kwargs.get('target_vm_tags', None) - self.seed_managed_disk_tags = kwargs.get('seed_managed_disk_tags', None) - self.target_managed_disk_tags = kwargs.get('target_managed_disk_tags', None) - self.target_nic_tags = kwargs.get('target_nic_tags', None) - - -class InMageAzureV2EventDetails(EventProviderSpecificDetails): - """Model class for event details of a VMwareAzureV2 event. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param event_type: InMage Event type. Takes one of the values of - InMageDataContract.InMageMonitoringEventType. - :type event_type: str - :param category: InMage Event Category. - :type category: str - :param component: InMage Event Component. - :type component: str - :param corrective_action: Corrective Action string for the event. - :type corrective_action: str - :param details: InMage Event Details. - :type details: str - :param summary: InMage Event Summary. - :type summary: str - :param site_name: VMware Site name. - :type site_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'event_type': {'key': 'eventType', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'component': {'key': 'component', 'type': 'str'}, - 'corrective_action': {'key': 'correctiveAction', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - 'summary': {'key': 'summary', 'type': 'str'}, - 'site_name': {'key': 'siteName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2EventDetails, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.event_type = kwargs.get('event_type', None) - self.category = kwargs.get('category', None) - self.component = kwargs.get('component', None) - self.corrective_action = kwargs.get('corrective_action', None) - self.details = kwargs.get('details', None) - self.summary = kwargs.get('summary', None) - self.site_name = kwargs.get('site_name', None) - - -class InMageAzureV2ManagedDiskDetails(msrest.serialization.Model): - """InMageAzureV2 Managed disk details. - - :param disk_id: The disk id. - :type disk_id: str - :param seed_managed_disk_id: Seed managed disk Id. - :type seed_managed_disk_id: str - :param replica_disk_type: The replica disk type. - :type replica_disk_type: str - :param disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :type disk_encryption_set_id: str - :param target_disk_name: The target disk name. - :type target_disk_name: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'seed_managed_disk_id': {'key': 'seedManagedDiskId', 'type': 'str'}, - 'replica_disk_type': {'key': 'replicaDiskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2ManagedDiskDetails, self).__init__(**kwargs) - self.disk_id = kwargs.get('disk_id', None) - self.seed_managed_disk_id = kwargs.get('seed_managed_disk_id', None) - self.replica_disk_type = kwargs.get('replica_disk_type', None) - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - self.target_disk_name = kwargs.get('target_disk_name', None) - - -class InMageAzureV2PolicyDetails(PolicyProviderSpecificDetails): - """InMage Azure v2 specific protection profile details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :type crash_consistent_frequency_in_minutes: int - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :type multi_vm_sync_status: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2PolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - self.recovery_point_threshold_in_minutes = kwargs.get('recovery_point_threshold_in_minutes', None) - self.recovery_point_history = kwargs.get('recovery_point_history', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.multi_vm_sync_status = kwargs.get('multi_vm_sync_status', None) - - -class InMageAzureV2PolicyInput(PolicyProviderSpecificInput): - """VMWare Azure specific policy Input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :type recovery_point_history: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: Required. A value indicating whether multi-VM sync has to be - enabled. Value should be 'Enabled' or 'Disabled'. Possible values include: "Enable", "Disable". - :type multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - - _validation = { - 'instance_type': {'required': True}, - 'multi_vm_sync_status': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2PolicyInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.recovery_point_threshold_in_minutes = kwargs.get('recovery_point_threshold_in_minutes', None) - self.recovery_point_history = kwargs.get('recovery_point_history', None) - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.multi_vm_sync_status = kwargs['multi_vm_sync_status'] - - -class InMageAzureV2ProtectedDiskDetails(msrest.serialization.Model): - """InMageAzureV2 protected disk details. - - :param disk_id: The disk id. - :type disk_id: str - :param disk_name: The disk name. - :type disk_name: str - :param protection_stage: The protection stage. - :type protection_stage: str - :param health_error_code: The health error code for the disk. - :type health_error_code: str - :param rpo_in_seconds: The RPO in seconds. - :type rpo_in_seconds: long - :param resync_required: A value indicating whether resync is required for this disk. - :type resync_required: str - :param resync_progress_percentage: The resync progress percentage. - :type resync_progress_percentage: int - :param resync_duration_in_seconds: The resync duration in seconds. - :type resync_duration_in_seconds: long - :param disk_capacity_in_bytes: The disk capacity in bytes. - :type disk_capacity_in_bytes: long - :param file_system_capacity_in_bytes: The disk file system capacity in bytes. - :type file_system_capacity_in_bytes: long - :param source_data_in_mega_bytes: The source data transit in MB. - :type source_data_in_mega_bytes: float - :param ps_data_in_mega_bytes: The PS data transit in MB. - :type ps_data_in_mega_bytes: float - :param target_data_in_mega_bytes: The target data transit in MB. - :type target_data_in_mega_bytes: float - :param disk_resized: A value indicating whether disk is resized. - :type disk_resized: str - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param resync_processed_bytes: The resync processed bytes. - :type resync_processed_bytes: long - :param resync_total_transferred_bytes: The resync total transferred bytes. - :type resync_total_transferred_bytes: long - :param resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. - :type resync_last15_minutes_transferred_bytes: long - :param resync_last_data_transfer_time_utc: The last data transfer time in UTC. - :type resync_last_data_transfer_time_utc: ~datetime.datetime - :param resync_start_time: The resync start time. - :type resync_start_time: ~datetime.datetime - :param progress_health: The Progress Health. - :type progress_health: str - :param progress_status: The Progress Status. - :type progress_status: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'protection_stage': {'key': 'protectionStage', 'type': 'str'}, - 'health_error_code': {'key': 'healthErrorCode', 'type': 'str'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'resync_duration_in_seconds': {'key': 'resyncDurationInSeconds', 'type': 'long'}, - 'disk_capacity_in_bytes': {'key': 'diskCapacityInBytes', 'type': 'long'}, - 'file_system_capacity_in_bytes': {'key': 'fileSystemCapacityInBytes', 'type': 'long'}, - 'source_data_in_mega_bytes': {'key': 'sourceDataInMegaBytes', 'type': 'float'}, - 'ps_data_in_mega_bytes': {'key': 'psDataInMegaBytes', 'type': 'float'}, - 'target_data_in_mega_bytes': {'key': 'targetDataInMegaBytes', 'type': 'float'}, - 'disk_resized': {'key': 'diskResized', 'type': 'str'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'resync_processed_bytes': {'key': 'resyncProcessedBytes', 'type': 'long'}, - 'resync_total_transferred_bytes': {'key': 'resyncTotalTransferredBytes', 'type': 'long'}, - 'resync_last15_minutes_transferred_bytes': {'key': 'resyncLast15MinutesTransferredBytes', 'type': 'long'}, - 'resync_last_data_transfer_time_utc': {'key': 'resyncLastDataTransferTimeUTC', 'type': 'iso-8601'}, - 'resync_start_time': {'key': 'resyncStartTime', 'type': 'iso-8601'}, - 'progress_health': {'key': 'progressHealth', 'type': 'str'}, - 'progress_status': {'key': 'progressStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2ProtectedDiskDetails, self).__init__(**kwargs) - self.disk_id = kwargs.get('disk_id', None) - self.disk_name = kwargs.get('disk_name', None) - self.protection_stage = kwargs.get('protection_stage', None) - self.health_error_code = kwargs.get('health_error_code', None) - self.rpo_in_seconds = kwargs.get('rpo_in_seconds', None) - self.resync_required = kwargs.get('resync_required', None) - self.resync_progress_percentage = kwargs.get('resync_progress_percentage', None) - self.resync_duration_in_seconds = kwargs.get('resync_duration_in_seconds', None) - self.disk_capacity_in_bytes = kwargs.get('disk_capacity_in_bytes', None) - self.file_system_capacity_in_bytes = kwargs.get('file_system_capacity_in_bytes', None) - self.source_data_in_mega_bytes = kwargs.get('source_data_in_mega_bytes', None) - self.ps_data_in_mega_bytes = kwargs.get('ps_data_in_mega_bytes', None) - self.target_data_in_mega_bytes = kwargs.get('target_data_in_mega_bytes', None) - self.disk_resized = kwargs.get('disk_resized', None) - self.last_rpo_calculated_time = kwargs.get('last_rpo_calculated_time', None) - self.resync_processed_bytes = kwargs.get('resync_processed_bytes', None) - self.resync_total_transferred_bytes = kwargs.get('resync_total_transferred_bytes', None) - self.resync_last15_minutes_transferred_bytes = kwargs.get('resync_last15_minutes_transferred_bytes', None) - self.resync_last_data_transfer_time_utc = kwargs.get('resync_last_data_transfer_time_utc', None) - self.resync_start_time = kwargs.get('resync_start_time', None) - self.progress_health = kwargs.get('progress_health', None) - self.progress_status = kwargs.get('progress_status', None) - - -class InMageAzureV2RecoveryPointDetails(ProviderSpecificRecoveryPointDetails): - """InMage Azure V2 provider specific recovery point details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the provider type.Constant filled by server. - :type instance_type: str - :param is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM - consistent. - :type is_multi_vm_sync_point: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'is_multi_vm_sync_point': {'key': 'isMultiVmSyncPoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2RecoveryPointDetails, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.is_multi_vm_sync_point = kwargs.get('is_multi_vm_sync_point', None) - - -class InMageAzureV2ReplicationDetails(ReplicationProviderSpecificSettings): - """InMageAzureV2 provider specific settings. - - 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. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param infrastructure_vm_id: The infrastructure VM Id. - :type infrastructure_vm_id: str - :param v_center_infrastructure_id: The vCenter infrastructure Id. - :type v_center_infrastructure_id: str - :param protection_stage: The protection stage. - :type protection_stage: str - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param resync_progress_percentage: The resync progress percentage. - :type resync_progress_percentage: int - :param rpo_in_seconds: The RPO in seconds. - :type rpo_in_seconds: long - :param compressed_data_rate_in_mb: The compressed data change rate in MB. - :type compressed_data_rate_in_mb: float - :param uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. - :type uncompressed_data_rate_in_mb: float - :param ip_address: The source IP address. - :type ip_address: str - :param agent_version: The agent version. - :type agent_version: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param is_agent_update_required: A value indicating whether installed agent needs to be - updated. - :type is_agent_update_required: str - :param is_reboot_after_update_required: A value indicating whether the source server requires a - restart after update. - :type is_reboot_after_update_required: str - :param last_heartbeat: The last heartbeat received from the source server. - :type last_heartbeat: ~datetime.datetime - :param process_server_id: The process server Id. - :type process_server_id: str - :param process_server_name: The process server name. - :type process_server_name: str - :param multi_vm_group_id: The multi vm group Id. - :type multi_vm_group_id: str - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_sync_status: A value indicating whether multi vm sync is enabled or disabled. - :type multi_vm_sync_status: str - :param protected_disks: The list of protected disks. - :type protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ProtectedDiskDetails] - :param disk_resized: A value indicating whether any disk is resized for this VM. - :type disk_resized: str - :param master_target_id: The master target Id. - :type master_target_id: str - :param source_vm_cpu_count: The CPU count of the VM on the primary side. - :type source_vm_cpu_count: int - :param source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :type source_vm_ram_size_in_mb: int - :param os_type: The type of the OS on the VM. - :type os_type: str - :param vhd_name: The OS disk VHD name. - :type vhd_name: str - :param os_disk_id: The id of the disk containing the OS. - :type os_disk_id: str - :param azure_vm_disk_details: Azure VM Disk details. - :type azure_vm_disk_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] - :param recovery_azure_vm_name: Recovery Azure given name. - :type recovery_azure_vm_name: str - :param recovery_azure_vm_size: The Recovery Azure VM size. - :type recovery_azure_vm_size: str - :param recovery_azure_storage_account: The recovery Azure storage account. - :type recovery_azure_storage_account: str - :param recovery_azure_log_storage_account_id: The ARM id of the log storage account used for - replication. This will be set to null if no log storage account was provided during enable - protection. - :type recovery_azure_log_storage_account_id: str - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param selected_recovery_azure_network_id: The selected recovery azure network Id. - :type selected_recovery_azure_network_id: str - :param selected_tfo_azure_network_id: The test failover virtual network. - :type selected_tfo_azure_network_id: str - :param selected_source_nic_id: The selected source nic Id which will be used as the primary nic - during failover. - :type selected_source_nic_id: str - :param discovery_type: A value indicating the discovery type of the machine. Value can be - vCenter or physical. - :type discovery_type: str - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param datastores: The datastores of the on-premise machine. Value can be list of strings that - contain datastore names. - :type datastores: list[str] - :param target_vm_id: The ARM Id of the target Azure VM. This value will be null until the VM is - failed over. Only after failure it will be populated with the ARM Id of the Azure VM. - :type target_vm_id: str - :param recovery_azure_resource_group_id: The target resource group Id. - :type recovery_azure_resource_group_id: str - :param recovery_availability_set_id: The recovery availability set Id. - :type recovery_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during - failover. - :type use_managed_disks: str - :param license_type: License Type of the VM to be used. - :type license_type: str - :param sql_server_license_type: The SQL Server license type. - :type sql_server_license_type: str - :param validation_errors: The validation errors of the on-premise machine Value can be list of - validation errors. - :type validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param last_update_received_time: The last update time received from on-prem components. - :type last_update_received_time: ~datetime.datetime - :param replica_id: The replica id of the protected item. - :type replica_id: str - :param os_version: The OS Version of the protected item. - :type os_version: str - :param protected_managed_disks: The list of protected managed disks. - :type protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ManagedDiskDetails] - :ivar last_recovery_point_received: The last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :param firmware_type: The firmware type of this protected item. - :type firmware_type: str - :param azure_vm_generation: The target generation for this protected item. - :type azure_vm_generation: str - :param is_additional_stats_available: A value indicating whether additional IR stats are - available or not. - :type is_additional_stats_available: bool - :param total_data_transferred: The total transferred data in bytes. - :type total_data_transferred: long - :param total_progress_health: The progress health. - :type total_progress_health: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_managed_disk_tags: The tags for the seed managed disks. - :type seed_managed_disk_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - 'last_recovery_point_received': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'infrastructure_vm_id': {'key': 'infrastructureVmId', 'type': 'str'}, - 'v_center_infrastructure_id': {'key': 'vCenterInfrastructureId', 'type': 'str'}, - 'protection_stage': {'key': 'protectionStage', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'compressed_data_rate_in_mb': {'key': 'compressedDataRateInMB', 'type': 'float'}, - 'uncompressed_data_rate_in_mb': {'key': 'uncompressedDataRateInMB', 'type': 'float'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'is_agent_update_required': {'key': 'isAgentUpdateRequired', 'type': 'str'}, - 'is_reboot_after_update_required': {'key': 'isRebootAfterUpdateRequired', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'process_server_name': {'key': 'processServerName', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[InMageAzureV2ProtectedDiskDetails]'}, - 'disk_resized': {'key': 'diskResized', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'source_vm_cpu_count': {'key': 'sourceVmCpuCount', 'type': 'int'}, - 'source_vm_ram_size_in_mb': {'key': 'sourceVmRamSizeInMB', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vhd_name': {'key': 'vhdName', 'type': 'str'}, - 'os_disk_id': {'key': 'osDiskId', 'type': 'str'}, - 'azure_vm_disk_details': {'key': 'azureVMDiskDetails', 'type': '[AzureVmDiskDetails]'}, - 'recovery_azure_vm_name': {'key': 'recoveryAzureVMName', 'type': 'str'}, - 'recovery_azure_vm_size': {'key': 'recoveryAzureVMSize', 'type': 'str'}, - 'recovery_azure_storage_account': {'key': 'recoveryAzureStorageAccount', 'type': 'str'}, - 'recovery_azure_log_storage_account_id': {'key': 'recoveryAzureLogStorageAccountId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'selected_recovery_azure_network_id': {'key': 'selectedRecoveryAzureNetworkId', 'type': 'str'}, - 'selected_tfo_azure_network_id': {'key': 'selectedTfoAzureNetworkId', 'type': 'str'}, - 'selected_source_nic_id': {'key': 'selectedSourceNicId', 'type': 'str'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'datastores': {'key': 'datastores', 'type': '[str]'}, - 'target_vm_id': {'key': 'targetVmId', 'type': 'str'}, - 'recovery_azure_resource_group_id': {'key': 'recoveryAzureResourceGroupId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'validation_errors': {'key': 'validationErrors', 'type': '[HealthError]'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'last_update_received_time': {'key': 'lastUpdateReceivedTime', 'type': 'iso-8601'}, - 'replica_id': {'key': 'replicaId', 'type': 'str'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'protected_managed_disks': {'key': 'protectedManagedDisks', 'type': '[InMageAzureV2ManagedDiskDetails]'}, - 'last_recovery_point_received': {'key': 'lastRecoveryPointReceived', 'type': 'iso-8601'}, - 'firmware_type': {'key': 'firmwareType', 'type': 'str'}, - 'azure_vm_generation': {'key': 'azureVmGeneration', 'type': 'str'}, - 'is_additional_stats_available': {'key': 'isAdditionalStatsAvailable', 'type': 'bool'}, - 'total_data_transferred': {'key': 'totalDataTransferred', 'type': 'long'}, - 'total_progress_health': {'key': 'totalProgressHealth', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_managed_disk_tags': {'key': 'seedManagedDiskTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2ReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.infrastructure_vm_id = kwargs.get('infrastructure_vm_id', None) - self.v_center_infrastructure_id = kwargs.get('v_center_infrastructure_id', None) - self.protection_stage = kwargs.get('protection_stage', None) - self.vm_id = kwargs.get('vm_id', None) - self.vm_protection_state = kwargs.get('vm_protection_state', None) - self.vm_protection_state_description = kwargs.get('vm_protection_state_description', None) - self.resync_progress_percentage = kwargs.get('resync_progress_percentage', None) - self.rpo_in_seconds = kwargs.get('rpo_in_seconds', None) - self.compressed_data_rate_in_mb = kwargs.get('compressed_data_rate_in_mb', None) - self.uncompressed_data_rate_in_mb = kwargs.get('uncompressed_data_rate_in_mb', None) - self.ip_address = kwargs.get('ip_address', None) - self.agent_version = kwargs.get('agent_version', None) - self.agent_expiry_date = kwargs.get('agent_expiry_date', None) - self.is_agent_update_required = kwargs.get('is_agent_update_required', None) - self.is_reboot_after_update_required = kwargs.get('is_reboot_after_update_required', None) - self.last_heartbeat = kwargs.get('last_heartbeat', None) - self.process_server_id = kwargs.get('process_server_id', None) - self.process_server_name = kwargs.get('process_server_name', None) - self.multi_vm_group_id = kwargs.get('multi_vm_group_id', None) - self.multi_vm_group_name = kwargs.get('multi_vm_group_name', None) - self.multi_vm_sync_status = kwargs.get('multi_vm_sync_status', None) - self.protected_disks = kwargs.get('protected_disks', None) - self.disk_resized = kwargs.get('disk_resized', None) - self.master_target_id = kwargs.get('master_target_id', None) - self.source_vm_cpu_count = kwargs.get('source_vm_cpu_count', None) - self.source_vm_ram_size_in_mb = kwargs.get('source_vm_ram_size_in_mb', None) - self.os_type = kwargs.get('os_type', None) - self.vhd_name = kwargs.get('vhd_name', None) - self.os_disk_id = kwargs.get('os_disk_id', None) - self.azure_vm_disk_details = kwargs.get('azure_vm_disk_details', None) - self.recovery_azure_vm_name = kwargs.get('recovery_azure_vm_name', None) - self.recovery_azure_vm_size = kwargs.get('recovery_azure_vm_size', None) - self.recovery_azure_storage_account = kwargs.get('recovery_azure_storage_account', None) - self.recovery_azure_log_storage_account_id = kwargs.get('recovery_azure_log_storage_account_id', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.selected_recovery_azure_network_id = kwargs.get('selected_recovery_azure_network_id', None) - self.selected_tfo_azure_network_id = kwargs.get('selected_tfo_azure_network_id', None) - self.selected_source_nic_id = kwargs.get('selected_source_nic_id', None) - self.discovery_type = kwargs.get('discovery_type', None) - self.enable_rdp_on_target_option = kwargs.get('enable_rdp_on_target_option', None) - self.datastores = kwargs.get('datastores', None) - self.target_vm_id = kwargs.get('target_vm_id', None) - self.recovery_azure_resource_group_id = kwargs.get('recovery_azure_resource_group_id', None) - self.recovery_availability_set_id = kwargs.get('recovery_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.use_managed_disks = kwargs.get('use_managed_disks', None) - self.license_type = kwargs.get('license_type', None) - self.sql_server_license_type = kwargs.get('sql_server_license_type', None) - self.validation_errors = kwargs.get('validation_errors', None) - self.last_rpo_calculated_time = kwargs.get('last_rpo_calculated_time', None) - self.last_update_received_time = kwargs.get('last_update_received_time', None) - self.replica_id = kwargs.get('replica_id', None) - self.os_version = kwargs.get('os_version', None) - self.protected_managed_disks = kwargs.get('protected_managed_disks', None) - self.last_recovery_point_received = None - self.firmware_type = kwargs.get('firmware_type', None) - self.azure_vm_generation = kwargs.get('azure_vm_generation', None) - self.is_additional_stats_available = kwargs.get('is_additional_stats_available', None) - self.total_data_transferred = kwargs.get('total_data_transferred', None) - self.total_progress_health = kwargs.get('total_progress_health', None) - self.target_vm_tags = kwargs.get('target_vm_tags', None) - self.seed_managed_disk_tags = kwargs.get('seed_managed_disk_tags', None) - self.target_managed_disk_tags = kwargs.get('target_managed_disk_tags', None) - self.target_nic_tags = kwargs.get('target_nic_tags', None) - - -class InMageAzureV2ReprotectInput(ReverseReplicationProviderSpecificInput): - """InMageAzureV2 specific provider input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param master_target_id: The Master target Id. - :type master_target_id: str - :param process_server_id: The Process Server Id. - :type process_server_id: str - :param storage_account_id: The storage account id. - :type storage_account_id: str - :param run_as_account_id: The CS account Id. - :type run_as_account_id: str - :param policy_id: The Policy Id. - :type policy_id: str - :param log_storage_account_id: The storage account to be used for logging during replication. - :type log_storage_account_id: str - :param disks_to_include: The disks to include list. - :type disks_to_include: list[str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2ReprotectInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.master_target_id = kwargs.get('master_target_id', None) - self.process_server_id = kwargs.get('process_server_id', None) - self.storage_account_id = kwargs.get('storage_account_id', None) - self.run_as_account_id = kwargs.get('run_as_account_id', None) - self.policy_id = kwargs.get('policy_id', None) - self.log_storage_account_id = kwargs.get('log_storage_account_id', None) - self.disks_to_include = kwargs.get('disks_to_include', None) - - -class InMageAzureV2TestFailoverInput(TestFailoverProviderSpecificInput): - """InMageAzureV2 provider specific input for test failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2TestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.recovery_point_id = kwargs.get('recovery_point_id', None) - - -class InMageAzureV2UnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """InMageAzureV2 provider specific input for unplanned failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2UnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.recovery_point_id = kwargs.get('recovery_point_id', None) - - -class InMageAzureV2UpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProviderInput): - """InMage Azure V2 input to update replication protected item. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic - deployment. - :type recovery_azure_v1_resource_group_id: str - :param recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource - manager deployment. - :type recovery_azure_v2_resource_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during - failover. - :type use_managed_disks: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param vm_disks: The list of disk update properties. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_azure_v1_resource_group_id': {'key': 'recoveryAzureV1ResourceGroupId', 'type': 'str'}, - 'recovery_azure_v2_resource_group_id': {'key': 'recoveryAzureV2ResourceGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[UpdateDiskInput]'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageAzureV2UpdateReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.recovery_azure_v1_resource_group_id = kwargs.get('recovery_azure_v1_resource_group_id', None) - self.recovery_azure_v2_resource_group_id = kwargs.get('recovery_azure_v2_resource_group_id', None) - self.use_managed_disks = kwargs.get('use_managed_disks', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_vm_tags = kwargs.get('target_vm_tags', None) - self.target_managed_disk_tags = kwargs.get('target_managed_disk_tags', None) - self.target_nic_tags = kwargs.get('target_nic_tags', None) - self.sql_server_license_type = kwargs.get('sql_server_license_type', None) - self.vm_disks = kwargs.get('vm_disks', None) - - -class InMageBasePolicyDetails(PolicyProviderSpecificDetails): - """Base class for the policies of providers using InMage replication. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :type multi_vm_sync_status: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageBasePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMageBasePolicyDetails' # type: str - self.recovery_point_threshold_in_minutes = kwargs.get('recovery_point_threshold_in_minutes', None) - self.recovery_point_history = kwargs.get('recovery_point_history', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.multi_vm_sync_status = kwargs.get('multi_vm_sync_status', None) - - -class InMageDisableProtectionProviderSpecificInput(DisableProtectionProviderSpecificInput): - """InMage disable protection provider specific input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param replica_vm_deletion_status: A value indicating whether the replica VM should be - destroyed or retained. Values from Delete and Retain. - :type replica_vm_deletion_status: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'replica_vm_deletion_status': {'key': 'replicaVmDeletionStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageDisableProtectionProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str - self.replica_vm_deletion_status = kwargs.get('replica_vm_deletion_status', None) - - -class InMageDiskDetails(msrest.serialization.Model): - """VMware/Physical specific Disk Details. - - :param disk_id: The disk Id. - :type disk_id: str - :param disk_name: The disk name. - :type disk_name: str - :param disk_size_in_mb: The disk size in MB. - :type disk_size_in_mb: str - :param disk_type: Whether disk is system disk or data disk. - :type disk_type: str - :param disk_configuration: Whether disk is dynamic disk or basic disk. - :type disk_configuration: str - :param volume_list: Volumes of the disk. - :type volume_list: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskVolumeDetails] - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'disk_size_in_mb': {'key': 'diskSizeInMB', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_configuration': {'key': 'diskConfiguration', 'type': 'str'}, - 'volume_list': {'key': 'volumeList', 'type': '[DiskVolumeDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageDiskDetails, self).__init__(**kwargs) - self.disk_id = kwargs.get('disk_id', None) - self.disk_name = kwargs.get('disk_name', None) - self.disk_size_in_mb = kwargs.get('disk_size_in_mb', None) - self.disk_type = kwargs.get('disk_type', None) - self.disk_configuration = kwargs.get('disk_configuration', None) - self.volume_list = kwargs.get('volume_list', None) - - -class InMageDiskExclusionInput(msrest.serialization.Model): - """DiskExclusionInput when doing enable protection of virtual machine in InMage provider. - - :param volume_options: The volume label based option for disk exclusion. - :type volume_options: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions] - :param disk_signature_options: The guest disk signature based option for disk exclusion. - :type disk_signature_options: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions] - """ - - _attribute_map = { - 'volume_options': {'key': 'volumeOptions', 'type': '[InMageVolumeExclusionOptions]'}, - 'disk_signature_options': {'key': 'diskSignatureOptions', 'type': '[InMageDiskSignatureExclusionOptions]'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageDiskExclusionInput, self).__init__(**kwargs) - self.volume_options = kwargs.get('volume_options', None) - self.disk_signature_options = kwargs.get('disk_signature_options', None) - - -class InMageDiskSignatureExclusionOptions(msrest.serialization.Model): - """Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. - - :param disk_signature: The guest signature of disk to be excluded from replication. - :type disk_signature: str - """ - - _attribute_map = { - 'disk_signature': {'key': 'diskSignature', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageDiskSignatureExclusionOptions, self).__init__(**kwargs) - self.disk_signature = kwargs.get('disk_signature', None) - - -class InMageEnableProtectionInput(EnableProtectionProviderSpecificInput): - """VMware Azure specific enable protection input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param vm_friendly_name: The VM Name. - :type vm_friendly_name: str - :param master_target_id: Required. The Master Target Id. - :type master_target_id: str - :param process_server_id: Required. The Process Server Id. - :type process_server_id: str - :param retention_drive: Required. The retention drive to use on the MT. - :type retention_drive: str - :param run_as_account_id: The CS account Id. - :type run_as_account_id: str - :param multi_vm_group_id: Required. The multi VM group Id. - :type multi_vm_group_id: str - :param multi_vm_group_name: Required. The multi VM group name. - :type multi_vm_group_name: str - :param datastore_name: The target datastore name. - :type datastore_name: str - :param disk_exclusion_input: The enable disk exclusion input. - :type disk_exclusion_input: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput - :param disks_to_include: The disks to include list. - :type disks_to_include: list[str] - """ - - _validation = { - 'instance_type': {'required': True}, - 'master_target_id': {'required': True}, - 'process_server_id': {'required': True}, - 'retention_drive': {'required': True}, - 'multi_vm_group_id': {'required': True}, - 'multi_vm_group_name': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_friendly_name': {'key': 'vmFriendlyName', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'retention_drive': {'key': 'retentionDrive', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'datastore_name': {'key': 'datastoreName', 'type': 'str'}, - 'disk_exclusion_input': {'key': 'diskExclusionInput', 'type': 'InMageDiskExclusionInput'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str - self.vm_friendly_name = kwargs.get('vm_friendly_name', None) - self.master_target_id = kwargs['master_target_id'] - self.process_server_id = kwargs['process_server_id'] - self.retention_drive = kwargs['retention_drive'] - self.run_as_account_id = kwargs.get('run_as_account_id', None) - self.multi_vm_group_id = kwargs['multi_vm_group_id'] - self.multi_vm_group_name = kwargs['multi_vm_group_name'] - self.datastore_name = kwargs.get('datastore_name', None) - self.disk_exclusion_input = kwargs.get('disk_exclusion_input', None) - self.disks_to_include = kwargs.get('disks_to_include', None) - - -class InMagePolicyDetails(PolicyProviderSpecificDetails): - """InMage specific protection profile details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :type multi_vm_sync_status: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMagePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str - self.recovery_point_threshold_in_minutes = kwargs.get('recovery_point_threshold_in_minutes', None) - self.recovery_point_history = kwargs.get('recovery_point_history', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.multi_vm_sync_status = kwargs.get('multi_vm_sync_status', None) - - -class InMagePolicyInput(PolicyProviderSpecificInput): - """VMWare Azure specific protection profile Input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: Required. A value indicating whether multi-VM sync has to be - enabled. Value should be 'Enabled' or 'Disabled'. Possible values include: "Enable", "Disable". - :type multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - - _validation = { - 'instance_type': {'required': True}, - 'multi_vm_sync_status': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMagePolicyInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str - self.recovery_point_threshold_in_minutes = kwargs.get('recovery_point_threshold_in_minutes', None) - self.recovery_point_history = kwargs.get('recovery_point_history', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.multi_vm_sync_status = kwargs['multi_vm_sync_status'] - - -class InMageProtectedDiskDetails(msrest.serialization.Model): - """InMage protected disk details. - - :param disk_id: The disk id. - :type disk_id: str - :param disk_name: The disk name. - :type disk_name: str - :param protection_stage: The protection stage. - :type protection_stage: str - :param health_error_code: The health error code for the disk. - :type health_error_code: str - :param rpo_in_seconds: The RPO in seconds. - :type rpo_in_seconds: long - :param resync_required: A value indicating whether resync is required for this disk. - :type resync_required: str - :param resync_progress_percentage: The resync progress percentage. - :type resync_progress_percentage: int - :param resync_duration_in_seconds: The resync duration in seconds. - :type resync_duration_in_seconds: long - :param disk_capacity_in_bytes: The disk capacity in bytes. - :type disk_capacity_in_bytes: long - :param file_system_capacity_in_bytes: The file system capacity in bytes. - :type file_system_capacity_in_bytes: long - :param source_data_in_mb: The source data transit in MB. - :type source_data_in_mb: float - :param ps_data_in_mb: The PS data transit in MB. - :type ps_data_in_mb: float - :param target_data_in_mb: The target data transit in MB. - :type target_data_in_mb: float - :param disk_resized: A value indicating whether disk is resized. - :type disk_resized: str - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param resync_processed_bytes: The resync processed bytes. - :type resync_processed_bytes: long - :param resync_total_transferred_bytes: The resync total transferred bytes. - :type resync_total_transferred_bytes: long - :param resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. - :type resync_last15_minutes_transferred_bytes: long - :param resync_last_data_transfer_time_utc: The last data transfer time in UTC. - :type resync_last_data_transfer_time_utc: ~datetime.datetime - :param resync_start_time: The resync start time. - :type resync_start_time: ~datetime.datetime - :param progress_health: The Progress Health. - :type progress_health: str - :param progress_status: The Progress Status. - :type progress_status: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'protection_stage': {'key': 'protectionStage', 'type': 'str'}, - 'health_error_code': {'key': 'healthErrorCode', 'type': 'str'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'resync_duration_in_seconds': {'key': 'resyncDurationInSeconds', 'type': 'long'}, - 'disk_capacity_in_bytes': {'key': 'diskCapacityInBytes', 'type': 'long'}, - 'file_system_capacity_in_bytes': {'key': 'fileSystemCapacityInBytes', 'type': 'long'}, - 'source_data_in_mb': {'key': 'sourceDataInMB', 'type': 'float'}, - 'ps_data_in_mb': {'key': 'psDataInMB', 'type': 'float'}, - 'target_data_in_mb': {'key': 'targetDataInMB', 'type': 'float'}, - 'disk_resized': {'key': 'diskResized', 'type': 'str'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'resync_processed_bytes': {'key': 'resyncProcessedBytes', 'type': 'long'}, - 'resync_total_transferred_bytes': {'key': 'resyncTotalTransferredBytes', 'type': 'long'}, - 'resync_last15_minutes_transferred_bytes': {'key': 'resyncLast15MinutesTransferredBytes', 'type': 'long'}, - 'resync_last_data_transfer_time_utc': {'key': 'resyncLastDataTransferTimeUTC', 'type': 'iso-8601'}, - 'resync_start_time': {'key': 'resyncStartTime', 'type': 'iso-8601'}, - 'progress_health': {'key': 'progressHealth', 'type': 'str'}, - 'progress_status': {'key': 'progressStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageProtectedDiskDetails, self).__init__(**kwargs) - self.disk_id = kwargs.get('disk_id', None) - self.disk_name = kwargs.get('disk_name', None) - self.protection_stage = kwargs.get('protection_stage', None) - self.health_error_code = kwargs.get('health_error_code', None) - self.rpo_in_seconds = kwargs.get('rpo_in_seconds', None) - self.resync_required = kwargs.get('resync_required', None) - self.resync_progress_percentage = kwargs.get('resync_progress_percentage', None) - self.resync_duration_in_seconds = kwargs.get('resync_duration_in_seconds', None) - self.disk_capacity_in_bytes = kwargs.get('disk_capacity_in_bytes', None) - self.file_system_capacity_in_bytes = kwargs.get('file_system_capacity_in_bytes', None) - self.source_data_in_mb = kwargs.get('source_data_in_mb', None) - self.ps_data_in_mb = kwargs.get('ps_data_in_mb', None) - self.target_data_in_mb = kwargs.get('target_data_in_mb', None) - self.disk_resized = kwargs.get('disk_resized', None) - self.last_rpo_calculated_time = kwargs.get('last_rpo_calculated_time', None) - self.resync_processed_bytes = kwargs.get('resync_processed_bytes', None) - self.resync_total_transferred_bytes = kwargs.get('resync_total_transferred_bytes', None) - self.resync_last15_minutes_transferred_bytes = kwargs.get('resync_last15_minutes_transferred_bytes', None) - self.resync_last_data_transfer_time_utc = kwargs.get('resync_last_data_transfer_time_utc', None) - self.resync_start_time = kwargs.get('resync_start_time', None) - self.progress_health = kwargs.get('progress_health', None) - self.progress_status = kwargs.get('progress_status', None) - - -class InMageRcmAgentUpgradeBlockingErrorDetails(msrest.serialization.Model): - """InMageRcm source agent upgrade blocking error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar possible_causes: The possible causes. - :vartype possible_causes: str - :ivar recommended_action: The recommended action. - :vartype recommended_action: str - :ivar error_message_parameters: The error message parameters. - :vartype error_message_parameters: dict[str, str] - :ivar error_tags: The error tags. - :vartype error_tags: dict[str, str] - """ - - _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'possible_causes': {'readonly': True}, - 'recommended_action': {'readonly': True}, - 'error_message_parameters': {'readonly': True}, - 'error_tags': {'readonly': True}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'error_message_parameters': {'key': 'errorMessageParameters', 'type': '{str}'}, - 'error_tags': {'key': 'errorTags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmAgentUpgradeBlockingErrorDetails, self).__init__(**kwargs) - self.error_code = None - self.error_message = None - self.possible_causes = None - self.recommended_action = None - self.error_message_parameters = None - self.error_tags = None - - -class InMageRcmApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): - """ApplyRecoveryPoint input specific to InMageRcm provider. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: Required. The recovery point Id. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_point_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.recovery_point_id = kwargs['recovery_point_id'] - - -class InMageRcmDiscoveredProtectedVmDetails(msrest.serialization.Model): - """InMageRcm discovered protected VM details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar v_center_id: The VCenter Id. - :vartype v_center_id: str - :ivar v_center_fqdn: The VCenter fqdn. - :vartype v_center_fqdn: str - :ivar datastores: The list of datastores. - :vartype datastores: list[str] - :ivar ip_addresses: The list of IP addresses. - :vartype ip_addresses: list[str] - :ivar vmware_tools_status: The VMware tools status. - :vartype vmware_tools_status: str - :ivar power_status: The VM power status. - :vartype power_status: str - :ivar vm_fqdn: The VM fqdn. - :vartype vm_fqdn: str - :ivar os_name: The VM's OS name. - :vartype os_name: str - :ivar created_timestamp: The SDS created timestamp. - :vartype created_timestamp: ~datetime.datetime - :ivar updated_timestamp: The SDS updated timestamp. - :vartype updated_timestamp: ~datetime.datetime - :ivar is_deleted: A value indicating whether the VM is deleted. - :vartype is_deleted: bool - :ivar last_discovery_time_in_utc: The last time when SDS information discovered in SRS. - :vartype last_discovery_time_in_utc: ~datetime.datetime - """ - - _validation = { - 'v_center_id': {'readonly': True}, - 'v_center_fqdn': {'readonly': True}, - 'datastores': {'readonly': True}, - 'ip_addresses': {'readonly': True}, - 'vmware_tools_status': {'readonly': True}, - 'power_status': {'readonly': True}, - 'vm_fqdn': {'readonly': True}, - 'os_name': {'readonly': True}, - 'created_timestamp': {'readonly': True}, - 'updated_timestamp': {'readonly': True}, - 'is_deleted': {'readonly': True}, - 'last_discovery_time_in_utc': {'readonly': True}, - } - - _attribute_map = { - 'v_center_id': {'key': 'vCenterId', 'type': 'str'}, - 'v_center_fqdn': {'key': 'vCenterFqdn', 'type': 'str'}, - 'datastores': {'key': 'datastores', 'type': '[str]'}, - 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, - 'vmware_tools_status': {'key': 'vmwareToolsStatus', 'type': 'str'}, - 'power_status': {'key': 'powerStatus', 'type': 'str'}, - 'vm_fqdn': {'key': 'vmFqdn', 'type': 'str'}, - 'os_name': {'key': 'osName', 'type': 'str'}, - 'created_timestamp': {'key': 'createdTimestamp', 'type': 'iso-8601'}, - 'updated_timestamp': {'key': 'updatedTimestamp', 'type': 'iso-8601'}, - 'is_deleted': {'key': 'isDeleted', 'type': 'bool'}, - 'last_discovery_time_in_utc': {'key': 'lastDiscoveryTimeInUtc', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmDiscoveredProtectedVmDetails, self).__init__(**kwargs) - self.v_center_id = None - self.v_center_fqdn = None - self.datastores = None - self.ip_addresses = None - self.vmware_tools_status = None - self.power_status = None - self.vm_fqdn = None - self.os_name = None - self.created_timestamp = None - self.updated_timestamp = None - self.is_deleted = None - self.last_discovery_time_in_utc = None - - -class InMageRcmDiskInput(msrest.serialization.Model): - """InMageRcm disk input. - - All required parameters must be populated in order to send to Azure. - - :param disk_id: Required. The disk Id. - :type disk_id: str - :param log_storage_account_id: Required. The log storage account ARM Id. - :type log_storage_account_id: str - :param disk_type: Required. The disk type. Possible values include: "Standard_LRS", - "Premium_LRS", "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str - """ - - _validation = { - 'disk_id': {'required': True}, - 'log_storage_account_id': {'required': True}, - 'disk_type': {'required': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmDiskInput, self).__init__(**kwargs) - self.disk_id = kwargs['disk_id'] - self.log_storage_account_id = kwargs['log_storage_account_id'] - self.disk_type = kwargs['disk_type'] - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - - -class InMageRcmDisksDefaultInput(msrest.serialization.Model): - """InMageRcm disk input. - - All required parameters must be populated in order to send to Azure. - - :param log_storage_account_id: Required. The log storage account ARM Id. - :type log_storage_account_id: str - :param disk_type: Required. The disk type. Possible values include: "Standard_LRS", - "Premium_LRS", "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str - """ - - _validation = { - 'log_storage_account_id': {'required': True}, - 'disk_type': {'required': True}, - } - - _attribute_map = { - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmDisksDefaultInput, self).__init__(**kwargs) - self.log_storage_account_id = kwargs['log_storage_account_id'] - self.disk_type = kwargs['disk_type'] - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - - -class InMageRcmEnableProtectionInput(EnableProtectionProviderSpecificInput): - """InMageRcm specific enable protection input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param fabric_discovery_machine_id: Required. The ARM Id of discovered machine. - :type fabric_discovery_machine_id: str - :param disks_to_include: The disks to include list. - :type disks_to_include: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput] - :param disks_default: The default disk input. - :type disks_default: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput - :param target_resource_group_id: Required. The target resource group ARM Id. - :type target_resource_group_id: str - :param target_network_id: The selected target network ARM Id. - :type target_network_id: str - :param test_network_id: The selected test network ARM Id. - :type test_network_id: str - :param target_subnet_name: The selected target subnet name. - :type target_subnet_name: str - :param test_subnet_name: The selected test subnet name. - :type test_subnet_name: str - :param target_vm_name: The target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param license_type: The license type. Possible values include: "NotSpecified", - "NoLicenseType", "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param target_availability_set_id: The target availability set ARM Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param run_as_account_id: The run-as account Id. - :type run_as_account_id: str - :param process_server_id: Required. The process server Id. - :type process_server_id: str - :param multi_vm_group_name: The multi VM group name. - :type multi_vm_group_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'fabric_discovery_machine_id': {'required': True}, - 'target_resource_group_id': {'required': True}, - 'process_server_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_discovery_machine_id': {'key': 'fabricDiscoveryMachineId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[InMageRcmDiskInput]'}, - 'disks_default': {'key': 'disksDefault', 'type': 'InMageRcmDisksDefaultInput'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'test_network_id': {'key': 'testNetworkId', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'test_subnet_name': {'key': 'testSubnetName', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.fabric_discovery_machine_id = kwargs['fabric_discovery_machine_id'] - self.disks_to_include = kwargs.get('disks_to_include', None) - self.disks_default = kwargs.get('disks_default', None) - self.target_resource_group_id = kwargs['target_resource_group_id'] - self.target_network_id = kwargs.get('target_network_id', None) - self.test_network_id = kwargs.get('test_network_id', None) - self.target_subnet_name = kwargs.get('target_subnet_name', None) - self.test_subnet_name = kwargs.get('test_subnet_name', None) - self.target_vm_name = kwargs.get('target_vm_name', None) - self.target_vm_size = kwargs.get('target_vm_size', None) - self.license_type = kwargs.get('license_type', None) - self.target_availability_set_id = kwargs.get('target_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.target_boot_diagnostics_storage_account_id = kwargs.get('target_boot_diagnostics_storage_account_id', None) - self.run_as_account_id = kwargs.get('run_as_account_id', None) - self.process_server_id = kwargs['process_server_id'] - self.multi_vm_group_name = kwargs.get('multi_vm_group_name', None) - - -class InMageRcmEventDetails(EventProviderSpecificDetails): - """Event details for InMageRcm provider. - - 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. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :ivar protected_item_name: The protected item name. - :vartype protected_item_name: str - :ivar vm_name: The protected item name. - :vartype vm_name: str - :ivar latest_agent_version: The latest agent version. - :vartype latest_agent_version: str - :ivar job_id: The job Id. - :vartype job_id: str - :ivar fabric_name: The fabric name. - :vartype fabric_name: str - :ivar appliance_name: The appliance name. - :vartype appliance_name: str - :ivar server_type: The server type. - :vartype server_type: str - :ivar component_display_name: The component display name. - :vartype component_display_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'protected_item_name': {'readonly': True}, - 'vm_name': {'readonly': True}, - 'latest_agent_version': {'readonly': True}, - 'job_id': {'readonly': True}, - 'fabric_name': {'readonly': True}, - 'appliance_name': {'readonly': True}, - 'server_type': {'readonly': True}, - 'component_display_name': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'protected_item_name': {'key': 'protectedItemName', 'type': 'str'}, - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'latest_agent_version': {'key': 'latestAgentVersion', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'appliance_name': {'key': 'applianceName', 'type': 'str'}, - 'server_type': {'key': 'serverType', 'type': 'str'}, - 'component_display_name': {'key': 'componentDisplayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmEventDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.protected_item_name = None - self.vm_name = None - self.latest_agent_version = None - self.job_id = None - self.fabric_name = None - self.appliance_name = None - self.server_type = None - self.component_display_name = None - - -class InMageRcmFabricCreationInput(FabricSpecificCreationInput): - """InMageRcm fabric provider specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type.Constant filled by server. - :type instance_type: str - :param vmware_site_id: Required. The ARM Id of the VMware site. - :type vmware_site_id: str - :param physical_site_id: Required. The ARM Id of the physical site. - :type physical_site_id: str - :param source_agent_identity: Required. The identity provider input for source agent - authentication. - :type source_agent_identity: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - """ - - _validation = { - 'instance_type': {'required': True}, - 'vmware_site_id': {'required': True}, - 'physical_site_id': {'required': True}, - 'source_agent_identity': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_site_id': {'key': 'vmwareSiteId', 'type': 'str'}, - 'physical_site_id': {'key': 'physicalSiteId', 'type': 'str'}, - 'source_agent_identity': {'key': 'sourceAgentIdentity', 'type': 'IdentityProviderInput'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFabricCreationInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.vmware_site_id = kwargs['vmware_site_id'] - self.physical_site_id = kwargs['physical_site_id'] - self.source_agent_identity = kwargs['source_agent_identity'] - - -class InMageRcmFabricSpecificDetails(FabricSpecificDetails): - """InMageRcm fabric specific details. - - 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. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :ivar vmware_site_id: The ARM Id of the VMware site. - :vartype vmware_site_id: str - :ivar physical_site_id: The ARM Id of the physical site. - :vartype physical_site_id: str - :ivar service_endpoint: The service endpoint. - :vartype service_endpoint: str - :ivar service_resource_id: The service resource Id. - :vartype service_resource_id: str - :ivar service_container_id: The service container Id. - :vartype service_container_id: str - :ivar data_plane_uri: The data plane Uri. - :vartype data_plane_uri: str - :ivar control_plane_uri: The control plane Uri. - :vartype control_plane_uri: str - :param source_agent_identity_details: The source agent identity details. - :type source_agent_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :ivar process_servers: The list of process servers. - :vartype process_servers: - list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails] - :ivar rcm_proxies: The list of RCM proxies. - :vartype rcm_proxies: list[~azure.mgmt.recoveryservicessiterecovery.models.RcmProxyDetails] - :ivar push_installers: The list of push installers. - :vartype push_installers: - list[~azure.mgmt.recoveryservicessiterecovery.models.PushInstallerDetails] - :ivar replication_agents: The list of replication agents. - :vartype replication_agents: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAgentDetails] - :ivar reprotect_agents: The list of reprotect agents. - :vartype reprotect_agents: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReprotectAgentDetails] - :ivar mars_agents: The list of Mars agents. - :vartype mars_agents: list[~azure.mgmt.recoveryservicessiterecovery.models.MarsAgentDetails] - :ivar dras: The list of DRAs. - :vartype dras: list[~azure.mgmt.recoveryservicessiterecovery.models.DraDetails] - :ivar agent_details: The list of agent details. - :vartype agent_details: list[~azure.mgmt.recoveryservicessiterecovery.models.AgentDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - 'vmware_site_id': {'readonly': True}, - 'physical_site_id': {'readonly': True}, - 'service_endpoint': {'readonly': True}, - 'service_resource_id': {'readonly': True}, - 'service_container_id': {'readonly': True}, - 'data_plane_uri': {'readonly': True}, - 'control_plane_uri': {'readonly': True}, - 'process_servers': {'readonly': True}, - 'rcm_proxies': {'readonly': True}, - 'push_installers': {'readonly': True}, - 'replication_agents': {'readonly': True}, - 'reprotect_agents': {'readonly': True}, - 'mars_agents': {'readonly': True}, - 'dras': {'readonly': True}, - 'agent_details': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_site_id': {'key': 'vmwareSiteId', 'type': 'str'}, - 'physical_site_id': {'key': 'physicalSiteId', 'type': 'str'}, - 'service_endpoint': {'key': 'serviceEndpoint', 'type': 'str'}, - 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, - 'service_container_id': {'key': 'serviceContainerId', 'type': 'str'}, - 'data_plane_uri': {'key': 'dataPlaneUri', 'type': 'str'}, - 'control_plane_uri': {'key': 'controlPlaneUri', 'type': 'str'}, - 'source_agent_identity_details': {'key': 'sourceAgentIdentityDetails', 'type': 'IdentityProviderDetails'}, - 'process_servers': {'key': 'processServers', 'type': '[ProcessServerDetails]'}, - 'rcm_proxies': {'key': 'rcmProxies', 'type': '[RcmProxyDetails]'}, - 'push_installers': {'key': 'pushInstallers', 'type': '[PushInstallerDetails]'}, - 'replication_agents': {'key': 'replicationAgents', 'type': '[ReplicationAgentDetails]'}, - 'reprotect_agents': {'key': 'reprotectAgents', 'type': '[ReprotectAgentDetails]'}, - 'mars_agents': {'key': 'marsAgents', 'type': '[MarsAgentDetails]'}, - 'dras': {'key': 'dras', 'type': '[DraDetails]'}, - 'agent_details': {'key': 'agentDetails', 'type': '[AgentDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFabricSpecificDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.vmware_site_id = None - self.physical_site_id = None - self.service_endpoint = None - self.service_resource_id = None - self.service_container_id = None - self.data_plane_uri = None - self.control_plane_uri = None - self.source_agent_identity_details = kwargs.get('source_agent_identity_details', None) - self.process_servers = None - self.rcm_proxies = None - self.push_installers = None - self.replication_agents = None - self.reprotect_agents = None - self.mars_agents = None - self.dras = None - self.agent_details = None - - -class InMageRcmFailbackDiscoveredProtectedVmDetails(msrest.serialization.Model): - """InMageRcmFailback discovered VM details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar v_center_id: The VCenter Id. - :vartype v_center_id: str - :ivar v_center_fqdn: The VCenter fqdn. - :vartype v_center_fqdn: str - :ivar datastores: The list of datastores. - :vartype datastores: list[str] - :ivar ip_addresses: The list of IP addresses. - :vartype ip_addresses: list[str] - :ivar vmware_tools_status: The VMware tools status. - :vartype vmware_tools_status: str - :ivar power_status: The VM power status. - :vartype power_status: str - :ivar vm_fqdn: The VM fqdn. - :vartype vm_fqdn: str - :ivar os_name: The VM's OS name. - :vartype os_name: str - :ivar created_timestamp: The SDS created timestamp. - :vartype created_timestamp: ~datetime.datetime - :ivar updated_timestamp: The SDS updated timestamp. - :vartype updated_timestamp: ~datetime.datetime - :ivar is_deleted: A value indicating whether the VM is deleted. - :vartype is_deleted: bool - :ivar last_discovery_time_in_utc: The last time when SDS information discovered in SRS. - :vartype last_discovery_time_in_utc: ~datetime.datetime - """ - - _validation = { - 'v_center_id': {'readonly': True}, - 'v_center_fqdn': {'readonly': True}, - 'datastores': {'readonly': True}, - 'ip_addresses': {'readonly': True}, - 'vmware_tools_status': {'readonly': True}, - 'power_status': {'readonly': True}, - 'vm_fqdn': {'readonly': True}, - 'os_name': {'readonly': True}, - 'created_timestamp': {'readonly': True}, - 'updated_timestamp': {'readonly': True}, - 'is_deleted': {'readonly': True}, - 'last_discovery_time_in_utc': {'readonly': True}, - } - - _attribute_map = { - 'v_center_id': {'key': 'vCenterId', 'type': 'str'}, - 'v_center_fqdn': {'key': 'vCenterFqdn', 'type': 'str'}, - 'datastores': {'key': 'datastores', 'type': '[str]'}, - 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, - 'vmware_tools_status': {'key': 'vmwareToolsStatus', 'type': 'str'}, - 'power_status': {'key': 'powerStatus', 'type': 'str'}, - 'vm_fqdn': {'key': 'vmFqdn', 'type': 'str'}, - 'os_name': {'key': 'osName', 'type': 'str'}, - 'created_timestamp': {'key': 'createdTimestamp', 'type': 'iso-8601'}, - 'updated_timestamp': {'key': 'updatedTimestamp', 'type': 'iso-8601'}, - 'is_deleted': {'key': 'isDeleted', 'type': 'bool'}, - 'last_discovery_time_in_utc': {'key': 'lastDiscoveryTimeInUtc', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackDiscoveredProtectedVmDetails, self).__init__(**kwargs) - self.v_center_id = None - self.v_center_fqdn = None - self.datastores = None - self.ip_addresses = None - self.vmware_tools_status = None - self.power_status = None - self.vm_fqdn = None - self.os_name = None - self.created_timestamp = None - self.updated_timestamp = None - self.is_deleted = None - self.last_discovery_time_in_utc = None - - -class InMageRcmFailbackEventDetails(EventProviderSpecificDetails): - """Event details for InMageRcmFailback provider. - - 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. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :ivar protected_item_name: The protected item name. - :vartype protected_item_name: str - :ivar vm_name: The protected item name. - :vartype vm_name: str - :ivar appliance_name: The appliance name. - :vartype appliance_name: str - :ivar server_type: The server type. - :vartype server_type: str - :ivar component_display_name: The component display name. - :vartype component_display_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'protected_item_name': {'readonly': True}, - 'vm_name': {'readonly': True}, - 'appliance_name': {'readonly': True}, - 'server_type': {'readonly': True}, - 'component_display_name': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'protected_item_name': {'key': 'protectedItemName', 'type': 'str'}, - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'appliance_name': {'key': 'applianceName', 'type': 'str'}, - 'server_type': {'key': 'serverType', 'type': 'str'}, - 'component_display_name': {'key': 'componentDisplayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackEventDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str - self.protected_item_name = None - self.vm_name = None - self.appliance_name = None - self.server_type = None - self.component_display_name = None - - -class InMageRcmFailbackMobilityAgentDetails(msrest.serialization.Model): - """InMageRcmFailback mobility agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The agent version. - :vartype version: str - :ivar latest_version: The latest agent version available. - :vartype latest_version: str - :ivar driver_version: The driver version. - :vartype driver_version: str - :ivar latest_upgradable_version_without_reboot: The latest upgradeable version available - without reboot. - :vartype latest_upgradable_version_without_reboot: str - :ivar agent_version_expiry_date: The agent version expiry date. - :vartype agent_version_expiry_date: ~datetime.datetime - :ivar driver_version_expiry_date: The driver version expiry date. - :vartype driver_version_expiry_date: ~datetime.datetime - :ivar last_heartbeat_utc: The time of the last heartbeat received from the agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar reasons_blocking_upgrade: The whether update is possible or not. - :vartype reasons_blocking_upgrade: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentUpgradeBlockedReason] - :ivar is_upgradeable: A value indicating whether agent is upgradeable or not. - :vartype is_upgradeable: str - """ - - _validation = { - 'version': {'readonly': True}, - 'latest_version': {'readonly': True}, - 'driver_version': {'readonly': True}, - 'latest_upgradable_version_without_reboot': {'readonly': True}, - 'agent_version_expiry_date': {'readonly': True}, - 'driver_version_expiry_date': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'reasons_blocking_upgrade': {'readonly': True}, - 'is_upgradeable': {'readonly': True}, - } - - _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'driver_version': {'key': 'driverVersion', 'type': 'str'}, - 'latest_upgradable_version_without_reboot': {'key': 'latestUpgradableVersionWithoutReboot', 'type': 'str'}, - 'agent_version_expiry_date': {'key': 'agentVersionExpiryDate', 'type': 'iso-8601'}, - 'driver_version_expiry_date': {'key': 'driverVersionExpiryDate', 'type': 'iso-8601'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'reasons_blocking_upgrade': {'key': 'reasonsBlockingUpgrade', 'type': '[str]'}, - 'is_upgradeable': {'key': 'isUpgradeable', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackMobilityAgentDetails, self).__init__(**kwargs) - self.version = None - self.latest_version = None - self.driver_version = None - self.latest_upgradable_version_without_reboot = None - self.agent_version_expiry_date = None - self.driver_version_expiry_date = None - self.last_heartbeat_utc = None - self.reasons_blocking_upgrade = None - self.is_upgradeable = None - - -class InMageRcmFailbackNicDetails(msrest.serialization.Model): - """InMageRcmFailback NIC details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar mac_address: The mac address. - :vartype mac_address: str - :ivar network_name: The network name. - :vartype network_name: str - :ivar adapter_type: The adapter type. - :vartype adapter_type: str - :ivar source_ip_address: The IP address. - :vartype source_ip_address: str - """ - - _validation = { - 'mac_address': {'readonly': True}, - 'network_name': {'readonly': True}, - 'adapter_type': {'readonly': True}, - 'source_ip_address': {'readonly': True}, - } - - _attribute_map = { - 'mac_address': {'key': 'macAddress', 'type': 'str'}, - 'network_name': {'key': 'networkName', 'type': 'str'}, - 'adapter_type': {'key': 'adapterType', 'type': 'str'}, - 'source_ip_address': {'key': 'sourceIpAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackNicDetails, self).__init__(**kwargs) - self.mac_address = None - self.network_name = None - self.adapter_type = None - self.source_ip_address = None - - -class InMageRcmFailbackPlannedFailoverProviderInput(PlannedFailoverProviderSpecificFailoverInput): - """Provider specific input for InMageRcmFailback failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "ApplicationConsistent", "CrashConsistent". - :type recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackPlannedFailoverProviderInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str - self.recovery_point_type = kwargs['recovery_point_type'] - - -class InMageRcmFailbackPolicyCreationInput(PolicyProviderSpecificInput): - """InMageRcmFailback policy creation input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackPolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - - -class InMageRcmFailbackPolicyDetails(PolicyProviderSpecificDetails): - """InMageRcm failback specific policy details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :type crash_consistent_frequency_in_minutes: int - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackPolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - - -class InMageRcmFailbackProtectedDiskDetails(msrest.serialization.Model): - """InMageRcmFailback protected disk details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_id: The disk Id (reported by source agent). - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar is_os_disk: A value indicating whether the disk is the OS disk. - :vartype is_os_disk: str - :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: long - :ivar disk_uuid: The disk Uuid (reported by vCenter). - :vartype disk_uuid: str - :ivar data_pending_in_log_data_store_in_mb: The data pending in log data store in MB. - :vartype data_pending_in_log_data_store_in_mb: float - :ivar data_pending_at_source_agent_in_mb: The data pending at source agent in MB. - :vartype data_pending_at_source_agent_in_mb: float - :ivar is_initial_replication_complete: A value indicating whether initial replication is - complete or not. - :vartype is_initial_replication_complete: str - :param ir_details: The initial replication details. - :type ir_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails - :param resync_details: The resync details. - :type resync_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails - :ivar last_sync_time: The last sync time. - :vartype last_sync_time: ~datetime.datetime - """ - - _validation = { - 'disk_id': {'readonly': True}, - 'disk_name': {'readonly': True}, - 'is_os_disk': {'readonly': True}, - 'capacity_in_bytes': {'readonly': True}, - 'disk_uuid': {'readonly': True}, - 'data_pending_in_log_data_store_in_mb': {'readonly': True}, - 'data_pending_at_source_agent_in_mb': {'readonly': True}, - 'is_initial_replication_complete': {'readonly': True}, - 'last_sync_time': {'readonly': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'disk_uuid': {'key': 'diskUuid', 'type': 'str'}, - 'data_pending_in_log_data_store_in_mb': {'key': 'dataPendingInLogDataStoreInMB', 'type': 'float'}, - 'data_pending_at_source_agent_in_mb': {'key': 'dataPendingAtSourceAgentInMB', 'type': 'float'}, - 'is_initial_replication_complete': {'key': 'isInitialReplicationComplete', 'type': 'str'}, - 'ir_details': {'key': 'irDetails', 'type': 'InMageRcmFailbackSyncDetails'}, - 'resync_details': {'key': 'resyncDetails', 'type': 'InMageRcmFailbackSyncDetails'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackProtectedDiskDetails, self).__init__(**kwargs) - self.disk_id = None - self.disk_name = None - self.is_os_disk = None - self.capacity_in_bytes = None - self.disk_uuid = None - self.data_pending_in_log_data_store_in_mb = None - self.data_pending_at_source_agent_in_mb = None - self.is_initial_replication_complete = None - self.ir_details = kwargs.get('ir_details', None) - self.resync_details = kwargs.get('resync_details', None) - self.last_sync_time = None - - -class InMageRcmFailbackReplicationDetails(ReplicationProviderSpecificSettings): - """InMageRcmFailback provider specific details. - - 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. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :ivar internal_identifier: The virtual machine internal identifier. - :vartype internal_identifier: str - :ivar azure_virtual_machine_id: The ARM Id of the azure VM. - :vartype azure_virtual_machine_id: str - :ivar multi_vm_group_name: The multi VM group name. - :vartype multi_vm_group_name: str - :ivar reprotect_agent_id: The reprotect agent Id. - :vartype reprotect_agent_id: str - :ivar reprotect_agent_name: The reprotect agent name. - :vartype reprotect_agent_name: str - :ivar os_type: The type of the OS on the VM. - :vartype os_type: str - :ivar log_storage_account_id: The log storage account ARM Id. - :vartype log_storage_account_id: str - :ivar targetv_center_id: The target vCenter Id. - :vartype targetv_center_id: str - :ivar target_data_store_name: The target datastore name. - :vartype target_data_store_name: str - :ivar target_vm_name: The target VM name. - :vartype target_vm_name: str - :ivar initial_replication_progress_percentage: The initial replication progress percentage. - :vartype initial_replication_progress_percentage: int - :ivar initial_replication_processed_bytes: The initial replication processed bytes. This - includes sum of total bytes transferred and matched bytes on all selected disks in source VM. - :vartype initial_replication_processed_bytes: long - :ivar initial_replication_transferred_bytes: The initial replication transferred bytes from - source VM to target for all selected disks on source VM. - :vartype initial_replication_transferred_bytes: long - :ivar initial_replication_progress_health: The initial replication progress health. Possible - values include: "None", "InProgress", "SlowProgress", "NoProgress". - :vartype initial_replication_progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth - :ivar resync_progress_percentage: The resync progress percentage. - :vartype resync_progress_percentage: int - :ivar resync_processed_bytes: The resync processed bytes. This includes sum of total bytes - transferred and matched bytes on all selected disks in source VM. - :vartype resync_processed_bytes: long - :ivar resync_transferred_bytes: The resync transferred bytes from source VM to target for all - selected disks on source VM. - :vartype resync_transferred_bytes: long - :ivar resync_progress_health: The resync progress health. Possible values include: "None", - "InProgress", "SlowProgress", "NoProgress". - :vartype resync_progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth - :ivar resync_required: A value indicating whether resync is required. - :vartype resync_required: str - :ivar resync_state: The resync state. Possible values include: "None", - "PreparedForResynchronization", "StartedResynchronization". - :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState - :param protected_disks: The list of protected disks. - :type protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackProtectedDiskDetails] - :param mobility_agent_details: The mobility agent information. - :type mobility_agent_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackMobilityAgentDetails - :param vm_nics: The network details. - :type vm_nics: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackNicDetails] - :ivar last_planned_failover_start_time: The last planned failover start time. - :vartype last_planned_failover_start_time: ~datetime.datetime - :ivar last_planned_failover_status: The last planned failover status. Possible values include: - "Succeeded", "Failed", "Cancelled", "Unknown". - :vartype last_planned_failover_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverStatus - :param discovered_vm_details: The discovered VM information. - :type discovered_vm_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackDiscoveredProtectedVmDetails - :ivar last_used_policy_id: The policy Id used by the forward replication. - :vartype last_used_policy_id: str - :ivar last_used_policy_friendly_name: The policy friendly name used by the forward replication. - :vartype last_used_policy_friendly_name: str - :ivar is_agent_registration_successful_after_failover: A value indicating whether agent - registration was successful after failover. - :vartype is_agent_registration_successful_after_failover: bool - """ - - _validation = { - 'instance_type': {'required': True}, - 'internal_identifier': {'readonly': True}, - 'azure_virtual_machine_id': {'readonly': True}, - 'multi_vm_group_name': {'readonly': True}, - 'reprotect_agent_id': {'readonly': True}, - 'reprotect_agent_name': {'readonly': True}, - 'os_type': {'readonly': True}, - 'log_storage_account_id': {'readonly': True}, - 'targetv_center_id': {'readonly': True}, - 'target_data_store_name': {'readonly': True}, - 'target_vm_name': {'readonly': True}, - 'initial_replication_progress_percentage': {'readonly': True}, - 'initial_replication_processed_bytes': {'readonly': True}, - 'initial_replication_transferred_bytes': {'readonly': True}, - 'initial_replication_progress_health': {'readonly': True}, - 'resync_progress_percentage': {'readonly': True}, - 'resync_processed_bytes': {'readonly': True}, - 'resync_transferred_bytes': {'readonly': True}, - 'resync_progress_health': {'readonly': True}, - 'resync_required': {'readonly': True}, - 'resync_state': {'readonly': True}, - 'last_planned_failover_start_time': {'readonly': True}, - 'last_planned_failover_status': {'readonly': True}, - 'last_used_policy_id': {'readonly': True}, - 'last_used_policy_friendly_name': {'readonly': True}, - 'is_agent_registration_successful_after_failover': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'internal_identifier': {'key': 'internalIdentifier', 'type': 'str'}, - 'azure_virtual_machine_id': {'key': 'azureVirtualMachineId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'reprotect_agent_id': {'key': 'reprotectAgentId', 'type': 'str'}, - 'reprotect_agent_name': {'key': 'reprotectAgentName', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'targetv_center_id': {'key': 'targetvCenterId', 'type': 'str'}, - 'target_data_store_name': {'key': 'targetDataStoreName', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'initial_replication_progress_percentage': {'key': 'initialReplicationProgressPercentage', 'type': 'int'}, - 'initial_replication_processed_bytes': {'key': 'initialReplicationProcessedBytes', 'type': 'long'}, - 'initial_replication_transferred_bytes': {'key': 'initialReplicationTransferredBytes', 'type': 'long'}, - 'initial_replication_progress_health': {'key': 'initialReplicationProgressHealth', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'resync_processed_bytes': {'key': 'resyncProcessedBytes', 'type': 'long'}, - 'resync_transferred_bytes': {'key': 'resyncTransferredBytes', 'type': 'long'}, - 'resync_progress_health': {'key': 'resyncProgressHealth', 'type': 'str'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_state': {'key': 'resyncState', 'type': 'str'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[InMageRcmFailbackProtectedDiskDetails]'}, - 'mobility_agent_details': {'key': 'mobilityAgentDetails', 'type': 'InMageRcmFailbackMobilityAgentDetails'}, - 'vm_nics': {'key': 'vmNics', 'type': '[InMageRcmFailbackNicDetails]'}, - 'last_planned_failover_start_time': {'key': 'lastPlannedFailoverStartTime', 'type': 'iso-8601'}, - 'last_planned_failover_status': {'key': 'lastPlannedFailoverStatus', 'type': 'str'}, - 'discovered_vm_details': {'key': 'discoveredVmDetails', 'type': 'InMageRcmFailbackDiscoveredProtectedVmDetails'}, - 'last_used_policy_id': {'key': 'lastUsedPolicyId', 'type': 'str'}, - 'last_used_policy_friendly_name': {'key': 'lastUsedPolicyFriendlyName', 'type': 'str'}, - 'is_agent_registration_successful_after_failover': {'key': 'isAgentRegistrationSuccessfulAfterFailover', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str - self.internal_identifier = None - self.azure_virtual_machine_id = None - self.multi_vm_group_name = None - self.reprotect_agent_id = None - self.reprotect_agent_name = None - self.os_type = None - self.log_storage_account_id = None - self.targetv_center_id = None - self.target_data_store_name = None - self.target_vm_name = None - self.initial_replication_progress_percentage = None - self.initial_replication_processed_bytes = None - self.initial_replication_transferred_bytes = None - self.initial_replication_progress_health = None - self.resync_progress_percentage = None - self.resync_processed_bytes = None - self.resync_transferred_bytes = None - self.resync_progress_health = None - self.resync_required = None - self.resync_state = None - self.protected_disks = kwargs.get('protected_disks', None) - self.mobility_agent_details = kwargs.get('mobility_agent_details', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.last_planned_failover_start_time = None - self.last_planned_failover_status = None - self.discovered_vm_details = kwargs.get('discovered_vm_details', None) - self.last_used_policy_id = None - self.last_used_policy_friendly_name = None - self.is_agent_registration_successful_after_failover = None - - -class InMageRcmFailbackReprotectInput(ReverseReplicationProviderSpecificInput): - """InMageRcmFailback specific provider input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param process_server_id: Required. The process server Id. - :type process_server_id: str - :param run_as_account_id: The run as account Id. - :type run_as_account_id: str - :param policy_id: Required. The Policy Id. - :type policy_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'process_server_id': {'required': True}, - 'policy_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackReprotectInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str - self.process_server_id = kwargs['process_server_id'] - self.run_as_account_id = kwargs.get('run_as_account_id', None) - self.policy_id = kwargs['policy_id'] - - -class InMageRcmFailbackSyncDetails(msrest.serialization.Model): - """InMageRcmFailback disk level sync details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar progress_health: The progress health. Possible values include: "None", "InProgress", - "SlowProgress", "NoProgress", "Queued". - :vartype progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DiskReplicationProgressHealth - :ivar transferred_bytes: The transferred bytes from source VM to azure for the disk. - :vartype transferred_bytes: long - :ivar last15_minutes_transferred_bytes: The bytes transferred in last 15 minutes from source VM - to target. - :vartype last15_minutes_transferred_bytes: long - :ivar last_data_transfer_time_utc: The time of the last data transfer from source VM to target. - :vartype last_data_transfer_time_utc: str - :ivar processed_bytes: The total processed bytes. This includes bytes that are transferred from - source VM to target and matched bytes. - :vartype processed_bytes: long - :ivar start_time: The start time. - :vartype start_time: str - :ivar last_refresh_time: The last refresh time. - :vartype last_refresh_time: str - :ivar progress_percentage: Progress in percentage. Progress percentage is calculated based on - processed bytes. - :vartype progress_percentage: int - """ - - _validation = { - 'progress_health': {'readonly': True}, - 'transferred_bytes': {'readonly': True}, - 'last15_minutes_transferred_bytes': {'readonly': True}, - 'last_data_transfer_time_utc': {'readonly': True}, - 'processed_bytes': {'readonly': True}, - 'start_time': {'readonly': True}, - 'last_refresh_time': {'readonly': True}, - 'progress_percentage': {'readonly': True}, - } - - _attribute_map = { - 'progress_health': {'key': 'progressHealth', 'type': 'str'}, - 'transferred_bytes': {'key': 'transferredBytes', 'type': 'long'}, - 'last15_minutes_transferred_bytes': {'key': 'last15MinutesTransferredBytes', 'type': 'long'}, - 'last_data_transfer_time_utc': {'key': 'lastDataTransferTimeUtc', 'type': 'str'}, - 'processed_bytes': {'key': 'processedBytes', 'type': 'long'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'last_refresh_time': {'key': 'lastRefreshTime', 'type': 'str'}, - 'progress_percentage': {'key': 'progressPercentage', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackSyncDetails, self).__init__(**kwargs) - self.progress_health = None - self.transferred_bytes = None - self.last15_minutes_transferred_bytes = None - self.last_data_transfer_time_utc = None - self.processed_bytes = None - self.start_time = None - self.last_refresh_time = None - self.progress_percentage = None - - -class InMageRcmLastAgentUpgradeErrorDetails(msrest.serialization.Model): - """InMageRcm last source agent upgrade error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar possible_causes: The possible causes. - :vartype possible_causes: str - :ivar recommended_action: The recommended action. - :vartype recommended_action: str - :ivar error_message_parameters: The error message parameters. - :vartype error_message_parameters: dict[str, str] - :ivar error_tags: The error tags. - :vartype error_tags: dict[str, str] - """ - - _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'possible_causes': {'readonly': True}, - 'recommended_action': {'readonly': True}, - 'error_message_parameters': {'readonly': True}, - 'error_tags': {'readonly': True}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'error_message_parameters': {'key': 'errorMessageParameters', 'type': '{str}'}, - 'error_tags': {'key': 'errorTags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmLastAgentUpgradeErrorDetails, self).__init__(**kwargs) - self.error_code = None - self.error_message = None - self.possible_causes = None - self.recommended_action = None - self.error_message_parameters = None - self.error_tags = None - - -class InMageRcmMobilityAgentDetails(msrest.serialization.Model): - """InMageRcm mobility agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The agent version. - :vartype version: str - :ivar latest_version: The latest agent version available. - :vartype latest_version: str - :ivar latest_agent_release_date: The latest agent version release date. - :vartype latest_agent_release_date: str - :ivar driver_version: The driver version. - :vartype driver_version: str - :ivar latest_upgradable_version_without_reboot: The latest upgradeable version available - without reboot. - :vartype latest_upgradable_version_without_reboot: str - :ivar agent_version_expiry_date: The agent version expiry date. - :vartype agent_version_expiry_date: ~datetime.datetime - :ivar driver_version_expiry_date: The driver version expiry date. - :vartype driver_version_expiry_date: ~datetime.datetime - :ivar last_heartbeat_utc: The time of the last heartbeat received from the agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar reasons_blocking_upgrade: The whether update is possible or not. - :vartype reasons_blocking_upgrade: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentUpgradeBlockedReason] - :ivar is_upgradeable: A value indicating whether agent is upgradeable or not. - :vartype is_upgradeable: str - """ - - _validation = { - 'version': {'readonly': True}, - 'latest_version': {'readonly': True}, - 'latest_agent_release_date': {'readonly': True}, - 'driver_version': {'readonly': True}, - 'latest_upgradable_version_without_reboot': {'readonly': True}, - 'agent_version_expiry_date': {'readonly': True}, - 'driver_version_expiry_date': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'reasons_blocking_upgrade': {'readonly': True}, - 'is_upgradeable': {'readonly': True}, - } - - _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'latest_agent_release_date': {'key': 'latestAgentReleaseDate', 'type': 'str'}, - 'driver_version': {'key': 'driverVersion', 'type': 'str'}, - 'latest_upgradable_version_without_reboot': {'key': 'latestUpgradableVersionWithoutReboot', 'type': 'str'}, - 'agent_version_expiry_date': {'key': 'agentVersionExpiryDate', 'type': 'iso-8601'}, - 'driver_version_expiry_date': {'key': 'driverVersionExpiryDate', 'type': 'iso-8601'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'reasons_blocking_upgrade': {'key': 'reasonsBlockingUpgrade', 'type': '[str]'}, - 'is_upgradeable': {'key': 'isUpgradeable', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmMobilityAgentDetails, self).__init__(**kwargs) - self.version = None - self.latest_version = None - self.latest_agent_release_date = None - self.driver_version = None - self.latest_upgradable_version_without_reboot = None - self.agent_version_expiry_date = None - self.driver_version_expiry_date = None - self.last_heartbeat_utc = None - self.reasons_blocking_upgrade = None - self.is_upgradeable = None - - -class InMageRcmNicDetails(msrest.serialization.Model): - """InMageRcm NIC details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar nic_id: The NIC Id. - :vartype nic_id: str - :param is_primary_nic: A value indicating whether this is the primary NIC. - :type is_primary_nic: str - :param is_selected_for_failover: A value indicating whether this NIC is selected for failover. - :type is_selected_for_failover: str - :ivar source_ip_address: The source IP address. - :vartype source_ip_address: str - :ivar source_ip_address_type: The source IP address type. Possible values include: "Dynamic", - "Static". - :vartype source_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :ivar source_network_id: Source network Id. - :vartype source_network_id: str - :ivar source_subnet_name: Source subnet name. - :vartype source_subnet_name: str - :param target_ip_address: The target IP address. - :type target_ip_address: str - :param target_ip_address_type: The target IP address type. Possible values include: "Dynamic", - "Static". - :type target_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :param target_subnet_name: Target subnet name. - :type target_subnet_name: str - :param test_subnet_name: Test subnet name. - :type test_subnet_name: str - :param test_ip_address: The test IP address. - :type test_ip_address: str - :param test_ip_address_type: The test IP address type. Possible values include: "Dynamic", - "Static". - :type test_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - """ - - _validation = { - 'nic_id': {'readonly': True}, - 'source_ip_address': {'readonly': True}, - 'source_ip_address_type': {'readonly': True}, - 'source_network_id': {'readonly': True}, - 'source_subnet_name': {'readonly': True}, - } - - _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'is_primary_nic': {'key': 'isPrimaryNic', 'type': 'str'}, - 'is_selected_for_failover': {'key': 'isSelectedForFailover', 'type': 'str'}, - 'source_ip_address': {'key': 'sourceIPAddress', 'type': 'str'}, - 'source_ip_address_type': {'key': 'sourceIPAddressType', 'type': 'str'}, - 'source_network_id': {'key': 'sourceNetworkId', 'type': 'str'}, - 'source_subnet_name': {'key': 'sourceSubnetName', 'type': 'str'}, - 'target_ip_address': {'key': 'targetIPAddress', 'type': 'str'}, - 'target_ip_address_type': {'key': 'targetIPAddressType', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'test_subnet_name': {'key': 'testSubnetName', 'type': 'str'}, - 'test_ip_address': {'key': 'testIPAddress', 'type': 'str'}, - 'test_ip_address_type': {'key': 'testIPAddressType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmNicDetails, self).__init__(**kwargs) - self.nic_id = None - self.is_primary_nic = kwargs.get('is_primary_nic', None) - self.is_selected_for_failover = kwargs.get('is_selected_for_failover', None) - self.source_ip_address = None - self.source_ip_address_type = None - self.source_network_id = None - self.source_subnet_name = None - self.target_ip_address = kwargs.get('target_ip_address', None) - self.target_ip_address_type = kwargs.get('target_ip_address_type', None) - self.target_subnet_name = kwargs.get('target_subnet_name', None) - self.test_subnet_name = kwargs.get('test_subnet_name', None) - self.test_ip_address = kwargs.get('test_ip_address', None) - self.test_ip_address_type = kwargs.get('test_ip_address_type', None) - - -class InMageRcmNicInput(msrest.serialization.Model): - """InMageRcm NIC input. - - All required parameters must be populated in order to send to Azure. - - :param nic_id: Required. The NIC Id. - :type nic_id: str - :param is_primary_nic: Required. A value indicating whether this is the primary NIC. - :type is_primary_nic: str - :param is_selected_for_failover: A value indicating whether this NIC is selected for failover. - :type is_selected_for_failover: str - :param target_subnet_name: Target subnet name. - :type target_subnet_name: str - :param target_static_ip_address: The target static IP address. - :type target_static_ip_address: str - :param test_subnet_name: The test subnet name. - :type test_subnet_name: str - :param test_static_ip_address: The test static IP address. - :type test_static_ip_address: str - """ - - _validation = { - 'nic_id': {'required': True}, - 'is_primary_nic': {'required': True}, - } - - _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'is_primary_nic': {'key': 'isPrimaryNic', 'type': 'str'}, - 'is_selected_for_failover': {'key': 'isSelectedForFailover', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'target_static_ip_address': {'key': 'targetStaticIPAddress', 'type': 'str'}, - 'test_subnet_name': {'key': 'testSubnetName', 'type': 'str'}, - 'test_static_ip_address': {'key': 'testStaticIPAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmNicInput, self).__init__(**kwargs) - self.nic_id = kwargs['nic_id'] - self.is_primary_nic = kwargs['is_primary_nic'] - self.is_selected_for_failover = kwargs.get('is_selected_for_failover', None) - self.target_subnet_name = kwargs.get('target_subnet_name', None) - self.target_static_ip_address = kwargs.get('target_static_ip_address', None) - self.test_subnet_name = kwargs.get('test_subnet_name', None) - self.test_static_ip_address = kwargs.get('test_static_ip_address', None) - - -class InMageRcmPolicyCreationInput(PolicyProviderSpecificInput): - """InMageRcm policy creation input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :type recovery_point_history_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. - :type enable_multi_vm_sync: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_in_minutes': {'key': 'recoveryPointHistoryInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'enable_multi_vm_sync': {'key': 'enableMultiVmSync', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmPolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.recovery_point_history_in_minutes = kwargs.get('recovery_point_history_in_minutes', None) - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.enable_multi_vm_sync = kwargs.get('enable_multi_vm_sync', None) - - -class InMageRcmPolicyDetails(PolicyProviderSpecificDetails): - """InMageRcm specific policy details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :type recovery_point_history_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :type crash_consistent_frequency_in_minutes: int - :param enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. - :type enable_multi_vm_sync: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_in_minutes': {'key': 'recoveryPointHistoryInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'enable_multi_vm_sync': {'key': 'enableMultiVmSync', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmPolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.recovery_point_history_in_minutes = kwargs.get('recovery_point_history_in_minutes', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - self.enable_multi_vm_sync = kwargs.get('enable_multi_vm_sync', None) - - -class InMageRcmProtectedDiskDetails(msrest.serialization.Model): - """InMageRcm protected disk details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_id: The disk Id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar is_os_disk: A value indicating whether the disk is the OS disk. - :vartype is_os_disk: str - :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: long - :ivar log_storage_account_id: The log storage account ARM Id. - :vartype log_storage_account_id: str - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :vartype disk_encryption_set_id: str - :ivar seed_managed_disk_id: The ARM Id of the seed managed disk. - :vartype seed_managed_disk_id: str - :ivar target_managed_disk_id: The ARM Id of the target managed disk. - :vartype target_managed_disk_id: str - :param disk_type: The disk type. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar data_pending_in_log_data_store_in_mb: The data pending in log data store in MB. - :vartype data_pending_in_log_data_store_in_mb: float - :ivar data_pending_at_source_agent_in_mb: The data pending at source agent in MB. - :vartype data_pending_at_source_agent_in_mb: float - :ivar is_initial_replication_complete: A value indicating whether initial replication is - complete or not. - :vartype is_initial_replication_complete: str - :param ir_details: The initial replication details. - :type ir_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails - :param resync_details: The resync details. - :type resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails - """ - - _validation = { - 'disk_id': {'readonly': True}, - 'disk_name': {'readonly': True}, - 'is_os_disk': {'readonly': True}, - 'capacity_in_bytes': {'readonly': True}, - 'log_storage_account_id': {'readonly': True}, - 'disk_encryption_set_id': {'readonly': True}, - 'seed_managed_disk_id': {'readonly': True}, - 'target_managed_disk_id': {'readonly': True}, - 'data_pending_in_log_data_store_in_mb': {'readonly': True}, - 'data_pending_at_source_agent_in_mb': {'readonly': True}, - 'is_initial_replication_complete': {'readonly': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'seed_managed_disk_id': {'key': 'seedManagedDiskId', 'type': 'str'}, - 'target_managed_disk_id': {'key': 'targetManagedDiskId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'data_pending_in_log_data_store_in_mb': {'key': 'dataPendingInLogDataStoreInMB', 'type': 'float'}, - 'data_pending_at_source_agent_in_mb': {'key': 'dataPendingAtSourceAgentInMB', 'type': 'float'}, - 'is_initial_replication_complete': {'key': 'isInitialReplicationComplete', 'type': 'str'}, - 'ir_details': {'key': 'irDetails', 'type': 'InMageRcmSyncDetails'}, - 'resync_details': {'key': 'resyncDetails', 'type': 'InMageRcmSyncDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmProtectedDiskDetails, self).__init__(**kwargs) - self.disk_id = None - self.disk_name = None - self.is_os_disk = None - self.capacity_in_bytes = None - self.log_storage_account_id = None - self.disk_encryption_set_id = None - self.seed_managed_disk_id = None - self.target_managed_disk_id = None - self.disk_type = kwargs.get('disk_type', None) - self.data_pending_in_log_data_store_in_mb = None - self.data_pending_at_source_agent_in_mb = None - self.is_initial_replication_complete = None - self.ir_details = kwargs.get('ir_details', None) - self.resync_details = kwargs.get('resync_details', None) - - -class InMageRcmProtectionContainerMappingDetails(ProtectionContainerMappingProviderSpecificDetails): - """InMageRcm provider specific container mapping details. - - 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. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :ivar enable_agent_auto_upgrade: A value indicating whether the flag for enable agent auto - upgrade. - :vartype enable_agent_auto_upgrade: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'enable_agent_auto_upgrade': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'enable_agent_auto_upgrade': {'key': 'enableAgentAutoUpgrade', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmProtectionContainerMappingDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.enable_agent_auto_upgrade = None - - -class InMageRcmRecoveryPointDetails(ProviderSpecificRecoveryPointDetails): - """InMageRcm provider specific recovery point details. - - 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. - - :param instance_type: Required. Gets the provider type.Constant filled by server. - :type instance_type: str - :ivar is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM - consistent. - :vartype is_multi_vm_sync_point: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'is_multi_vm_sync_point': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'is_multi_vm_sync_point': {'key': 'isMultiVmSyncPoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmRecoveryPointDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.is_multi_vm_sync_point = None - - -class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings): - """InMageRcm provider specific details. - - 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. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :ivar internal_identifier: The virtual machine internal identifier. - :vartype internal_identifier: str - :ivar fabric_discovery_machine_id: The ARM Id of the discovered VM. - :vartype fabric_discovery_machine_id: str - :ivar multi_vm_group_name: The multi VM group name. - :vartype multi_vm_group_name: str - :ivar discovery_type: The type of the discovered VM. - :vartype discovery_type: str - :ivar process_server_id: The process server Id. - :vartype process_server_id: str - :ivar processor_core_count: The processor core count. - :vartype processor_core_count: int - :ivar allocated_memory_in_mb: The allocated memory in MB. - :vartype allocated_memory_in_mb: float - :ivar process_server_name: The process server name. - :vartype process_server_name: str - :ivar run_as_account_id: The run-as account Id. - :vartype run_as_account_id: str - :ivar os_type: The type of the OS on the VM. - :vartype os_type: str - :ivar firmware_type: The firmware type. - :vartype firmware_type: str - :ivar primary_nic_ip_address: The IP address of the primary network interface. - :vartype primary_nic_ip_address: str - :ivar target_generation: The target generation. - :vartype target_generation: str - :param license_type: License Type of the VM to be used. - :type license_type: str - :param target_vm_name: Target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_resource_group_id: The target resource group Id. - :type target_resource_group_id: str - :param target_location: The target location. - :type target_location: str - :param target_availability_set_id: The target availability set Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param target_network_id: The target network Id. - :type target_network_id: str - :param test_network_id: The test network Id. - :type test_network_id: str - :ivar failover_recovery_point_id: The recovery point Id to which the VM was failed over. - :vartype failover_recovery_point_id: str - :ivar last_recovery_point_received: The last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :ivar last_rpo_in_seconds: The last recovery point objective value. - :vartype last_rpo_in_seconds: long - :ivar last_rpo_calculated_time: The last recovery point objective calculated time. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar last_recovery_point_id: The last recovery point Id. - :vartype last_recovery_point_id: str - :ivar initial_replication_progress_percentage: The initial replication progress percentage. - This is calculated based on total bytes processed for all disks in the source VM. - :vartype initial_replication_progress_percentage: int - :ivar initial_replication_processed_bytes: The initial replication processed bytes. This - includes sum of total bytes transferred and matched bytes on all selected disks in source VM. - :vartype initial_replication_processed_bytes: long - :ivar initial_replication_transferred_bytes: The initial replication transferred bytes from - source VM to azure for all selected disks on source VM. - :vartype initial_replication_transferred_bytes: long - :ivar initial_replication_progress_health: The initial replication progress health. Possible - values include: "None", "InProgress", "SlowProgress", "NoProgress". - :vartype initial_replication_progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth - :ivar resync_progress_percentage: The resync progress percentage. This is calculated based on - total bytes processed for all disks in the source VM. - :vartype resync_progress_percentage: int - :ivar resync_processed_bytes: The resync processed bytes. This includes sum of total bytes - transferred and matched bytes on all selected disks in source VM. - :vartype resync_processed_bytes: long - :ivar resync_transferred_bytes: The resync transferred bytes from source VM to azure for all - selected disks on source VM. - :vartype resync_transferred_bytes: long - :ivar resync_progress_health: The resync progress health. Possible values include: "None", - "InProgress", "SlowProgress", "NoProgress". - :vartype resync_progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth - :ivar resync_required: A value indicating whether resync is required. - :vartype resync_required: str - :ivar resync_state: The resync state. Possible values include: "None", - "PreparedForResynchronization", "StartedResynchronization". - :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState - :ivar agent_upgrade_state: The agent auto upgrade state. Possible values include: "None", - "Started", "Completed", "Commit". - :vartype agent_upgrade_state: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MobilityAgentUpgradeState - :ivar last_agent_upgrade_type: The last agent upgrade type. - :vartype last_agent_upgrade_type: str - :ivar agent_upgrade_job_id: The agent upgrade job Id. - :vartype agent_upgrade_job_id: str - :ivar agent_upgrade_attempt_to_version: The agent version to which last agent upgrade was - attempted. - :vartype agent_upgrade_attempt_to_version: str - :param protected_disks: The list of protected disks. - :type protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmProtectedDiskDetails] - :ivar is_last_upgrade_successful: A value indicating whether last agent upgrade was successful - or not. - :vartype is_last_upgrade_successful: str - :ivar is_agent_registration_successful_after_failover: A value indicating whether agent - registration was successful after failover. - :vartype is_agent_registration_successful_after_failover: bool - :param mobility_agent_details: The mobility agent information. - :type mobility_agent_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmMobilityAgentDetails - :param last_agent_upgrade_error_details: The last agent upgrade error information. - :type last_agent_upgrade_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmLastAgentUpgradeErrorDetails] - :param agent_upgrade_blocking_error_details: The agent upgrade blocking error information. - :type agent_upgrade_blocking_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAgentUpgradeBlockingErrorDetails] - :param vm_nics: The network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicDetails] - :param discovered_vm_details: The discovered VM details. - :type discovered_vm_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiscoveredProtectedVmDetails - """ - - _validation = { - 'instance_type': {'required': True}, - 'internal_identifier': {'readonly': True}, - 'fabric_discovery_machine_id': {'readonly': True}, - 'multi_vm_group_name': {'readonly': True}, - 'discovery_type': {'readonly': True}, - 'process_server_id': {'readonly': True}, - 'processor_core_count': {'readonly': True}, - 'allocated_memory_in_mb': {'readonly': True}, - 'process_server_name': {'readonly': True}, - 'run_as_account_id': {'readonly': True}, - 'os_type': {'readonly': True}, - 'firmware_type': {'readonly': True}, - 'primary_nic_ip_address': {'readonly': True}, - 'target_generation': {'readonly': True}, - 'failover_recovery_point_id': {'readonly': True}, - 'last_recovery_point_received': {'readonly': True}, - 'last_rpo_in_seconds': {'readonly': True}, - 'last_rpo_calculated_time': {'readonly': True}, - 'last_recovery_point_id': {'readonly': True}, - 'initial_replication_progress_percentage': {'readonly': True}, - 'initial_replication_processed_bytes': {'readonly': True}, - 'initial_replication_transferred_bytes': {'readonly': True}, - 'initial_replication_progress_health': {'readonly': True}, - 'resync_progress_percentage': {'readonly': True}, - 'resync_processed_bytes': {'readonly': True}, - 'resync_transferred_bytes': {'readonly': True}, - 'resync_progress_health': {'readonly': True}, - 'resync_required': {'readonly': True}, - 'resync_state': {'readonly': True}, - 'agent_upgrade_state': {'readonly': True}, - 'last_agent_upgrade_type': {'readonly': True}, - 'agent_upgrade_job_id': {'readonly': True}, - 'agent_upgrade_attempt_to_version': {'readonly': True}, - 'is_last_upgrade_successful': {'readonly': True}, - 'is_agent_registration_successful_after_failover': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'internal_identifier': {'key': 'internalIdentifier', 'type': 'str'}, - 'fabric_discovery_machine_id': {'key': 'fabricDiscoveryMachineId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'processor_core_count': {'key': 'processorCoreCount', 'type': 'int'}, - 'allocated_memory_in_mb': {'key': 'allocatedMemoryInMB', 'type': 'float'}, - 'process_server_name': {'key': 'processServerName', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'firmware_type': {'key': 'firmwareType', 'type': 'str'}, - 'primary_nic_ip_address': {'key': 'primaryNicIpAddress', 'type': 'str'}, - 'target_generation': {'key': 'targetGeneration', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_location': {'key': 'targetLocation', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'test_network_id': {'key': 'testNetworkId', 'type': 'str'}, - 'failover_recovery_point_id': {'key': 'failoverRecoveryPointId', 'type': 'str'}, - 'last_recovery_point_received': {'key': 'lastRecoveryPointReceived', 'type': 'iso-8601'}, - 'last_rpo_in_seconds': {'key': 'lastRpoInSeconds', 'type': 'long'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'last_recovery_point_id': {'key': 'lastRecoveryPointId', 'type': 'str'}, - 'initial_replication_progress_percentage': {'key': 'initialReplicationProgressPercentage', 'type': 'int'}, - 'initial_replication_processed_bytes': {'key': 'initialReplicationProcessedBytes', 'type': 'long'}, - 'initial_replication_transferred_bytes': {'key': 'initialReplicationTransferredBytes', 'type': 'long'}, - 'initial_replication_progress_health': {'key': 'initialReplicationProgressHealth', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'resync_processed_bytes': {'key': 'resyncProcessedBytes', 'type': 'long'}, - 'resync_transferred_bytes': {'key': 'resyncTransferredBytes', 'type': 'long'}, - 'resync_progress_health': {'key': 'resyncProgressHealth', 'type': 'str'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_state': {'key': 'resyncState', 'type': 'str'}, - 'agent_upgrade_state': {'key': 'agentUpgradeState', 'type': 'str'}, - 'last_agent_upgrade_type': {'key': 'lastAgentUpgradeType', 'type': 'str'}, - 'agent_upgrade_job_id': {'key': 'agentUpgradeJobId', 'type': 'str'}, - 'agent_upgrade_attempt_to_version': {'key': 'agentUpgradeAttemptToVersion', 'type': 'str'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[InMageRcmProtectedDiskDetails]'}, - 'is_last_upgrade_successful': {'key': 'isLastUpgradeSuccessful', 'type': 'str'}, - 'is_agent_registration_successful_after_failover': {'key': 'isAgentRegistrationSuccessfulAfterFailover', 'type': 'bool'}, - 'mobility_agent_details': {'key': 'mobilityAgentDetails', 'type': 'InMageRcmMobilityAgentDetails'}, - 'last_agent_upgrade_error_details': {'key': 'lastAgentUpgradeErrorDetails', 'type': '[InMageRcmLastAgentUpgradeErrorDetails]'}, - 'agent_upgrade_blocking_error_details': {'key': 'agentUpgradeBlockingErrorDetails', 'type': '[InMageRcmAgentUpgradeBlockingErrorDetails]'}, - 'vm_nics': {'key': 'vmNics', 'type': '[InMageRcmNicDetails]'}, - 'discovered_vm_details': {'key': 'discoveredVmDetails', 'type': 'InMageRcmDiscoveredProtectedVmDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.internal_identifier = None - self.fabric_discovery_machine_id = None - self.multi_vm_group_name = None - self.discovery_type = None - self.process_server_id = None - self.processor_core_count = None - self.allocated_memory_in_mb = None - self.process_server_name = None - self.run_as_account_id = None - self.os_type = None - self.firmware_type = None - self.primary_nic_ip_address = None - self.target_generation = None - self.license_type = kwargs.get('license_type', None) - self.target_vm_name = kwargs.get('target_vm_name', None) - self.target_vm_size = kwargs.get('target_vm_size', None) - self.target_resource_group_id = kwargs.get('target_resource_group_id', None) - self.target_location = kwargs.get('target_location', None) - self.target_availability_set_id = kwargs.get('target_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.target_boot_diagnostics_storage_account_id = kwargs.get('target_boot_diagnostics_storage_account_id', None) - self.target_network_id = kwargs.get('target_network_id', None) - self.test_network_id = kwargs.get('test_network_id', None) - self.failover_recovery_point_id = None - self.last_recovery_point_received = None - self.last_rpo_in_seconds = None - self.last_rpo_calculated_time = None - self.last_recovery_point_id = None - self.initial_replication_progress_percentage = None - self.initial_replication_processed_bytes = None - self.initial_replication_transferred_bytes = None - self.initial_replication_progress_health = None - self.resync_progress_percentage = None - self.resync_processed_bytes = None - self.resync_transferred_bytes = None - self.resync_progress_health = None - self.resync_required = None - self.resync_state = None - self.agent_upgrade_state = None - self.last_agent_upgrade_type = None - self.agent_upgrade_job_id = None - self.agent_upgrade_attempt_to_version = None - self.protected_disks = kwargs.get('protected_disks', None) - self.is_last_upgrade_successful = None - self.is_agent_registration_successful_after_failover = None - self.mobility_agent_details = kwargs.get('mobility_agent_details', None) - self.last_agent_upgrade_error_details = kwargs.get('last_agent_upgrade_error_details', None) - self.agent_upgrade_blocking_error_details = kwargs.get('agent_upgrade_blocking_error_details', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.discovered_vm_details = kwargs.get('discovered_vm_details', None) - - -class InMageRcmReprotectInput(ReverseReplicationProviderSpecificInput): - """InMageRcm specific provider input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param reprotect_agent_id: Required. The reprotect agent Id. - :type reprotect_agent_id: str - :param datastore_name: Required. The target datastore name. - :type datastore_name: str - :param log_storage_account_id: Required. The log storage account ARM Id. - :type log_storage_account_id: str - :param policy_id: The Policy Id. - :type policy_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'reprotect_agent_id': {'required': True}, - 'datastore_name': {'required': True}, - 'log_storage_account_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'reprotect_agent_id': {'key': 'reprotectAgentId', 'type': 'str'}, - 'datastore_name': {'key': 'datastoreName', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmReprotectInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.reprotect_agent_id = kwargs['reprotect_agent_id'] - self.datastore_name = kwargs['datastore_name'] - self.log_storage_account_id = kwargs['log_storage_account_id'] - self.policy_id = kwargs.get('policy_id', None) - - -class InMageRcmSyncDetails(msrest.serialization.Model): - """InMageRcm disk level sync details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar progress_health: The progress health. Possible values include: "None", "InProgress", - "SlowProgress", "NoProgress", "Queued". - :vartype progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DiskReplicationProgressHealth - :ivar transferred_bytes: The transferred bytes from source VM to azure for the disk. - :vartype transferred_bytes: long - :ivar last15_minutes_transferred_bytes: The bytes transferred in last 15 minutes from source VM - to azure. - :vartype last15_minutes_transferred_bytes: long - :ivar last_data_transfer_time_utc: The time of the last data transfer from source VM to azure. - :vartype last_data_transfer_time_utc: str - :ivar processed_bytes: The total processed bytes. This includes bytes that are transferred from - source VM to azure and matched bytes. - :vartype processed_bytes: long - :ivar start_time: The start time. - :vartype start_time: str - :ivar last_refresh_time: The last refresh time. - :vartype last_refresh_time: str - :ivar progress_percentage: Progress in percentage. Progress percentage is calculated based on - processed bytes. - :vartype progress_percentage: int - """ - - _validation = { - 'progress_health': {'readonly': True}, - 'transferred_bytes': {'readonly': True}, - 'last15_minutes_transferred_bytes': {'readonly': True}, - 'last_data_transfer_time_utc': {'readonly': True}, - 'processed_bytes': {'readonly': True}, - 'start_time': {'readonly': True}, - 'last_refresh_time': {'readonly': True}, - 'progress_percentage': {'readonly': True}, - } - - _attribute_map = { - 'progress_health': {'key': 'progressHealth', 'type': 'str'}, - 'transferred_bytes': {'key': 'transferredBytes', 'type': 'long'}, - 'last15_minutes_transferred_bytes': {'key': 'last15MinutesTransferredBytes', 'type': 'long'}, - 'last_data_transfer_time_utc': {'key': 'lastDataTransferTimeUtc', 'type': 'str'}, - 'processed_bytes': {'key': 'processedBytes', 'type': 'long'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'last_refresh_time': {'key': 'lastRefreshTime', 'type': 'str'}, - 'progress_percentage': {'key': 'progressPercentage', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmSyncDetails, self).__init__(**kwargs) - self.progress_health = None - self.transferred_bytes = None - self.last15_minutes_transferred_bytes = None - self.last_data_transfer_time_utc = None - self.processed_bytes = None - self.start_time = None - self.last_refresh_time = None - self.progress_percentage = None - - -class InMageRcmTestFailoverInput(TestFailoverProviderSpecificInput): - """InMageRcm provider specific input for test failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param network_id: The test network Id. - :type network_id: str - :param recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'network_id': {'key': 'networkId', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmTestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.network_id = kwargs.get('network_id', None) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - - -class InMageRcmUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """InMageRcm provider specific input for unplanned failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param perform_shutdown: Required. A value indicating whether VM is to be shutdown. - :type perform_shutdown: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'perform_shutdown': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'perform_shutdown': {'key': 'performShutdown', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmUnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.perform_shutdown = kwargs['perform_shutdown'] - self.recovery_point_id = kwargs.get('recovery_point_id', None) - - -class UpdateApplianceForReplicationProtectedItemProviderSpecificInput(msrest.serialization.Model): - """Update replication protected item provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: InMageRcmUpdateApplianceForReplicationProtectedItemInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'InMageRcm': 'InMageRcmUpdateApplianceForReplicationProtectedItemInput'} - } - - def __init__( - self, - **kwargs - ): - super(UpdateApplianceForReplicationProtectedItemProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class InMageRcmUpdateApplianceForReplicationProtectedItemInput(UpdateApplianceForReplicationProtectedItemProviderSpecificInput): - """InMageRcm provider specific input to update appliance for replication protected item. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param run_as_account_id: The run as account Id. - :type run_as_account_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmUpdateApplianceForReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.run_as_account_id = kwargs.get('run_as_account_id', None) - - -class InMageRcmUpdateContainerMappingInput(ReplicationProviderSpecificUpdateContainerMappingInput): - """InMageRcm update protection container mapping. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param enable_agent_auto_upgrade: Required. A value indicating whether agent auto upgrade has - to be enabled. - :type enable_agent_auto_upgrade: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'enable_agent_auto_upgrade': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'enable_agent_auto_upgrade': {'key': 'enableAgentAutoUpgrade', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmUpdateContainerMappingInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.enable_agent_auto_upgrade = kwargs['enable_agent_auto_upgrade'] - - -class InMageRcmUpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProviderInput): - """InMageRcm provider specific input to update replication protected item. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param target_vm_name: The target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_resource_group_id: The target resource group ARM Id. - :type target_resource_group_id: str - :param target_availability_set_id: The target availability set ARM Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param target_network_id: The target network ARM Id. - :type target_network_id: str - :param test_network_id: The test network ARM Id. - :type test_network_id: str - :param vm_nics: The list of NIC details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicInput] - :param license_type: The license type. Possible values include: "NotSpecified", - "NoLicenseType", "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'test_network_id': {'key': 'testNetworkId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[InMageRcmNicInput]'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageRcmUpdateReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.target_vm_name = kwargs.get('target_vm_name', None) - self.target_vm_size = kwargs.get('target_vm_size', None) - self.target_resource_group_id = kwargs.get('target_resource_group_id', None) - self.target_availability_set_id = kwargs.get('target_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.target_boot_diagnostics_storage_account_id = kwargs.get('target_boot_diagnostics_storage_account_id', None) - self.target_network_id = kwargs.get('target_network_id', None) - self.test_network_id = kwargs.get('test_network_id', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.license_type = kwargs.get('license_type', None) - - -class InMageReplicationDetails(ReplicationProviderSpecificSettings): - """InMage provider specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param active_site_type: The active location of the VM. If the VM is being protected from - Azure, this field will take values from { Azure, OnPrem }. If the VM is being protected between - two data-centers, this field will be OnPrem always. - :type active_site_type: str - :param source_vm_cpu_count: The CPU count of the VM on the primary side. - :type source_vm_cpu_count: int - :param source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :type source_vm_ram_size_in_mb: int - :param os_details: The OS details. - :type os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDiskDetails - :param protection_stage: The protection stage. - :type protection_stage: str - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param resync_details: The resync details of the machine. - :type resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param retention_window_start: The retention window start time. - :type retention_window_start: ~datetime.datetime - :param retention_window_end: The retention window end time. - :type retention_window_end: ~datetime.datetime - :param compressed_data_rate_in_mb: The compressed data change rate in MB. - :type compressed_data_rate_in_mb: float - :param uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. - :type uncompressed_data_rate_in_mb: float - :param rpo_in_seconds: The RPO in seconds. - :type rpo_in_seconds: long - :param protected_disks: The list of protected disks. - :type protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageProtectedDiskDetails] - :param ip_address: The source IP address. - :type ip_address: str - :param last_heartbeat: The last heartbeat received from the source server. - :type last_heartbeat: ~datetime.datetime - :param process_server_id: The process server Id. - :type process_server_id: str - :param master_target_id: The master target Id. - :type master_target_id: str - :param consistency_points: The collection of Consistency points. - :type consistency_points: dict[str, ~datetime.datetime] - :param disk_resized: A value indicating whether any disk is resized for this VM. - :type disk_resized: str - :param reboot_after_update_status: A value indicating whether the source server requires a - restart after update. - :type reboot_after_update_status: str - :param multi_vm_group_id: The multi vm group Id, if any. - :type multi_vm_group_id: str - :param multi_vm_group_name: The multi vm group name, if any. - :type multi_vm_group_name: str - :param multi_vm_sync_status: A value indicating whether the multi vm sync is enabled or - disabled. - :type multi_vm_sync_status: str - :param agent_details: The agent details. - :type agent_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageAgentDetails - :param v_center_infrastructure_id: The vCenter infrastructure Id. - :type v_center_infrastructure_id: str - :param infrastructure_vm_id: The infrastructure VM Id. - :type infrastructure_vm_id: str - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param discovery_type: A value indicating the discovery type of the machine. - :type discovery_type: str - :param azure_storage_account_id: A value indicating the underlying Azure storage account. If - the VM is not running in Azure, this value shall be set to null. - :type azure_storage_account_id: str - :param datastores: The datastores of the on-premise machine Value can be list of strings that - contain datastore names. - :type datastores: list[str] - :param validation_errors: The validation errors of the on-premise machine Value can be list of - validation errors. - :type validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param last_update_received_time: The last update time received from on-prem components. - :type last_update_received_time: ~datetime.datetime - :param replica_id: The replica id of the protected item. - :type replica_id: str - :param os_version: The OS Version of the protected item. - :type os_version: str - :param is_additional_stats_available: A value indicating whether additional IR stats are - available or not. - :type is_additional_stats_available: bool - :param total_data_transferred: The total transferred data in bytes. - :type total_data_transferred: long - :param total_progress_health: The progress health. - :type total_progress_health: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'active_site_type': {'key': 'activeSiteType', 'type': 'str'}, - 'source_vm_cpu_count': {'key': 'sourceVmCpuCount', 'type': 'int'}, - 'source_vm_ram_size_in_mb': {'key': 'sourceVmRamSizeInMB', 'type': 'int'}, - 'os_details': {'key': 'osDetails', 'type': 'OSDiskDetails'}, - 'protection_stage': {'key': 'protectionStage', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'resync_details': {'key': 'resyncDetails', 'type': 'InitialReplicationDetails'}, - 'retention_window_start': {'key': 'retentionWindowStart', 'type': 'iso-8601'}, - 'retention_window_end': {'key': 'retentionWindowEnd', 'type': 'iso-8601'}, - 'compressed_data_rate_in_mb': {'key': 'compressedDataRateInMB', 'type': 'float'}, - 'uncompressed_data_rate_in_mb': {'key': 'uncompressedDataRateInMB', 'type': 'float'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[InMageProtectedDiskDetails]'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'consistency_points': {'key': 'consistencyPoints', 'type': '{iso-8601}'}, - 'disk_resized': {'key': 'diskResized', 'type': 'str'}, - 'reboot_after_update_status': {'key': 'rebootAfterUpdateStatus', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - 'agent_details': {'key': 'agentDetails', 'type': 'InMageAgentDetails'}, - 'v_center_infrastructure_id': {'key': 'vCenterInfrastructureId', 'type': 'str'}, - 'infrastructure_vm_id': {'key': 'infrastructureVmId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'azure_storage_account_id': {'key': 'azureStorageAccountId', 'type': 'str'}, - 'datastores': {'key': 'datastores', 'type': '[str]'}, - 'validation_errors': {'key': 'validationErrors', 'type': '[HealthError]'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'last_update_received_time': {'key': 'lastUpdateReceivedTime', 'type': 'iso-8601'}, - 'replica_id': {'key': 'replicaId', 'type': 'str'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'is_additional_stats_available': {'key': 'isAdditionalStatsAvailable', 'type': 'bool'}, - 'total_data_transferred': {'key': 'totalDataTransferred', 'type': 'long'}, - 'total_progress_health': {'key': 'totalProgressHealth', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str - self.active_site_type = kwargs.get('active_site_type', None) - self.source_vm_cpu_count = kwargs.get('source_vm_cpu_count', None) - self.source_vm_ram_size_in_mb = kwargs.get('source_vm_ram_size_in_mb', None) - self.os_details = kwargs.get('os_details', None) - self.protection_stage = kwargs.get('protection_stage', None) - self.vm_id = kwargs.get('vm_id', None) - self.vm_protection_state = kwargs.get('vm_protection_state', None) - self.vm_protection_state_description = kwargs.get('vm_protection_state_description', None) - self.resync_details = kwargs.get('resync_details', None) - self.retention_window_start = kwargs.get('retention_window_start', None) - self.retention_window_end = kwargs.get('retention_window_end', None) - self.compressed_data_rate_in_mb = kwargs.get('compressed_data_rate_in_mb', None) - self.uncompressed_data_rate_in_mb = kwargs.get('uncompressed_data_rate_in_mb', None) - self.rpo_in_seconds = kwargs.get('rpo_in_seconds', None) - self.protected_disks = kwargs.get('protected_disks', None) - self.ip_address = kwargs.get('ip_address', None) - self.last_heartbeat = kwargs.get('last_heartbeat', None) - self.process_server_id = kwargs.get('process_server_id', None) - self.master_target_id = kwargs.get('master_target_id', None) - self.consistency_points = kwargs.get('consistency_points', None) - self.disk_resized = kwargs.get('disk_resized', None) - self.reboot_after_update_status = kwargs.get('reboot_after_update_status', None) - self.multi_vm_group_id = kwargs.get('multi_vm_group_id', None) - self.multi_vm_group_name = kwargs.get('multi_vm_group_name', None) - self.multi_vm_sync_status = kwargs.get('multi_vm_sync_status', None) - self.agent_details = kwargs.get('agent_details', None) - self.v_center_infrastructure_id = kwargs.get('v_center_infrastructure_id', None) - self.infrastructure_vm_id = kwargs.get('infrastructure_vm_id', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.discovery_type = kwargs.get('discovery_type', None) - self.azure_storage_account_id = kwargs.get('azure_storage_account_id', None) - self.datastores = kwargs.get('datastores', None) - self.validation_errors = kwargs.get('validation_errors', None) - self.last_rpo_calculated_time = kwargs.get('last_rpo_calculated_time', None) - self.last_update_received_time = kwargs.get('last_update_received_time', None) - self.replica_id = kwargs.get('replica_id', None) - self.os_version = kwargs.get('os_version', None) - self.is_additional_stats_available = kwargs.get('is_additional_stats_available', None) - self.total_data_transferred = kwargs.get('total_data_transferred', None) - self.total_progress_health = kwargs.get('total_progress_health', None) - - -class InMageReprotectInput(ReverseReplicationProviderSpecificInput): - """InMageAzureV2 specific provider input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param master_target_id: Required. The Master Target Id. - :type master_target_id: str - :param process_server_id: Required. The Process Server Id. - :type process_server_id: str - :param retention_drive: Required. The retention drive to use on the MT. - :type retention_drive: str - :param run_as_account_id: The CS account Id. - :type run_as_account_id: str - :param datastore_name: The target datastore name. - :type datastore_name: str - :param disk_exclusion_input: The enable disk exclusion input. - :type disk_exclusion_input: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput - :param profile_id: Required. The Policy Id. - :type profile_id: str - :param disks_to_include: The disks to include list. - :type disks_to_include: list[str] - """ - - _validation = { - 'instance_type': {'required': True}, - 'master_target_id': {'required': True}, - 'process_server_id': {'required': True}, - 'retention_drive': {'required': True}, - 'profile_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'retention_drive': {'key': 'retentionDrive', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'datastore_name': {'key': 'datastoreName', 'type': 'str'}, - 'disk_exclusion_input': {'key': 'diskExclusionInput', 'type': 'InMageDiskExclusionInput'}, - 'profile_id': {'key': 'profileId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageReprotectInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str - self.master_target_id = kwargs['master_target_id'] - self.process_server_id = kwargs['process_server_id'] - self.retention_drive = kwargs['retention_drive'] - self.run_as_account_id = kwargs.get('run_as_account_id', None) - self.datastore_name = kwargs.get('datastore_name', None) - self.disk_exclusion_input = kwargs.get('disk_exclusion_input', None) - self.profile_id = kwargs['profile_id'] - self.disks_to_include = kwargs.get('disks_to_include', None) - - -class InMageTestFailoverInput(TestFailoverProviderSpecificInput): - """Provider specific input for InMage test failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or - Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In - the other two cases, recovery point id will be ignored. Possible values include: "LatestTime", - "LatestTag", "Custom". - :type recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType - :param recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageTestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str - self.recovery_point_type = kwargs.get('recovery_point_type', None) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - - -class InMageUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """Provider specific input for InMage unplanned failover. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or - Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In - the other two cases, recovery point id will be ignored. Possible values include: "LatestTime", - "LatestTag", "Custom". - :type recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType - :param recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageUnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str - self.recovery_point_type = kwargs.get('recovery_point_type', None) - self.recovery_point_id = kwargs.get('recovery_point_id', None) - - -class InMageVolumeExclusionOptions(msrest.serialization.Model): - """Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. - - :param volume_label: The volume label. The disk having any volume with this label will be - excluded from replication. - :type volume_label: str - :param only_exclude_if_single_volume: The value indicating whether to exclude multi volume disk - or not. If a disk has multiple volumes and one of the volume has label matching with - VolumeLabel this disk will be excluded from replication if OnlyExcludeIfSingleVolume is false. - :type only_exclude_if_single_volume: str - """ - - _attribute_map = { - 'volume_label': {'key': 'volumeLabel', 'type': 'str'}, - 'only_exclude_if_single_volume': {'key': 'onlyExcludeIfSingleVolume', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InMageVolumeExclusionOptions, self).__init__(**kwargs) - self.volume_label = kwargs.get('volume_label', None) - self.only_exclude_if_single_volume = kwargs.get('only_exclude_if_single_volume', None) - - -class InnerHealthError(msrest.serialization.Model): - """Implements InnerHealthError class. HealthError object has a list of InnerHealthErrors as child errors. InnerHealthError is used because this will prevent an infinite loop of structures when Hydra tries to auto-generate the contract. We are exposing the related health errors as inner health errors and all API consumers can utilize this in the same fashion as Exception -> InnerException. - - :param error_source: Source of error. - :type error_source: str - :param error_type: Type of error. - :type error_type: str - :param error_level: Level of error. - :type error_level: str - :param error_category: Category of error. - :type error_category: str - :param error_code: Error code. - :type error_code: str - :param summary_message: Summary message of the entity. - :type summary_message: str - :param error_message: Error message. - :type error_message: str - :param possible_causes: Possible causes of error. - :type possible_causes: str - :param recommended_action: Recommended action to resolve error. - :type recommended_action: str - :param creation_time_utc: Error creation time (UTC). - :type creation_time_utc: ~datetime.datetime - :param recovery_provider_error_message: DRA error message. - :type recovery_provider_error_message: str - :param entity_id: ID of the entity. - :type entity_id: str - :param error_id: The health error unique id. - :type error_id: str - :param customer_resolvability: Value indicating whether the health error is customer - resolvable. Possible values include: "Allowed", "NotAllowed". - :type customer_resolvability: str or - ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability - """ - - _attribute_map = { - 'error_source': {'key': 'errorSource', 'type': 'str'}, - 'error_type': {'key': 'errorType', 'type': 'str'}, - 'error_level': {'key': 'errorLevel', 'type': 'str'}, - 'error_category': {'key': 'errorCategory', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'summary_message': {'key': 'summaryMessage', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'creation_time_utc': {'key': 'creationTimeUtc', 'type': 'iso-8601'}, - 'recovery_provider_error_message': {'key': 'recoveryProviderErrorMessage', 'type': 'str'}, - 'entity_id': {'key': 'entityId', 'type': 'str'}, - 'error_id': {'key': 'errorId', 'type': 'str'}, - 'customer_resolvability': {'key': 'customerResolvability', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InnerHealthError, self).__init__(**kwargs) - self.error_source = kwargs.get('error_source', None) - self.error_type = kwargs.get('error_type', None) - self.error_level = kwargs.get('error_level', None) - self.error_category = kwargs.get('error_category', None) - self.error_code = kwargs.get('error_code', None) - self.summary_message = kwargs.get('summary_message', None) - self.error_message = kwargs.get('error_message', None) - self.possible_causes = kwargs.get('possible_causes', None) - self.recommended_action = kwargs.get('recommended_action', None) - self.creation_time_utc = kwargs.get('creation_time_utc', None) - self.recovery_provider_error_message = kwargs.get('recovery_provider_error_message', None) - self.entity_id = kwargs.get('entity_id', None) - self.error_id = kwargs.get('error_id', None) - self.customer_resolvability = kwargs.get('customer_resolvability', None) - - -class InputEndpoint(msrest.serialization.Model): - """InputEndpoint. - - :param endpoint_name: - :type endpoint_name: str - :param private_port: - :type private_port: int - :param public_port: - :type public_port: int - :param protocol: - :type protocol: str - """ - - _attribute_map = { - 'endpoint_name': {'key': 'endpointName', 'type': 'str'}, - 'private_port': {'key': 'privatePort', 'type': 'int'}, - 'public_port': {'key': 'publicPort', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InputEndpoint, self).__init__(**kwargs) - self.endpoint_name = kwargs.get('endpoint_name', None) - self.private_port = kwargs.get('private_port', None) - self.public_port = kwargs.get('public_port', None) - self.protocol = kwargs.get('protocol', None) - - -class IPConfigDetails(msrest.serialization.Model): - """IPConfigDetails. - - :param name: - :type name: str - :param is_primary: - :type is_primary: bool - :param subnet_name: - :type subnet_name: str - :param static_ip_address: - :type static_ip_address: str - :param ip_address_type: - :type ip_address_type: str - :param is_seleted_for_failover: - :type is_seleted_for_failover: bool - :param recovery_subnet_name: - :type recovery_subnet_name: str - :param recovery_static_ip_address: - :type recovery_static_ip_address: str - :param recovery_ip_address_type: - :type recovery_ip_address_type: str - :param recovery_public_ip_address_id: - :type recovery_public_ip_address_id: str - :param recovery_lb_backend_address_pool_ids: - :type recovery_lb_backend_address_pool_ids: list[str] - :param tfo_subnet_name: - :type tfo_subnet_name: str - :param tfo_static_ip_address: - :type tfo_static_ip_address: str - :param tfo_public_ip_address_id: - :type tfo_public_ip_address_id: str - :param tfo_lb_backend_address_pool_ids: - :type tfo_lb_backend_address_pool_ids: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_primary': {'key': 'isPrimary', 'type': 'bool'}, - 'subnet_name': {'key': 'subnetName', 'type': 'str'}, - 'static_ip_address': {'key': 'staticIPAddress', 'type': 'str'}, - 'ip_address_type': {'key': 'ipAddressType', 'type': 'str'}, - 'is_seleted_for_failover': {'key': 'isSeletedForFailover', 'type': 'bool'}, - 'recovery_subnet_name': {'key': 'recoverySubnetName', 'type': 'str'}, - 'recovery_static_ip_address': {'key': 'recoveryStaticIPAddress', 'type': 'str'}, - 'recovery_ip_address_type': {'key': 'recoveryIPAddressType', 'type': 'str'}, - 'recovery_public_ip_address_id': {'key': 'recoveryPublicIPAddressId', 'type': 'str'}, - 'recovery_lb_backend_address_pool_ids': {'key': 'recoveryLBBackendAddressPoolIds', 'type': '[str]'}, - 'tfo_subnet_name': {'key': 'tfoSubnetName', 'type': 'str'}, - 'tfo_static_ip_address': {'key': 'tfoStaticIPAddress', 'type': 'str'}, - 'tfo_public_ip_address_id': {'key': 'tfoPublicIPAddressId', 'type': 'str'}, - 'tfo_lb_backend_address_pool_ids': {'key': 'tfoLBBackendAddressPoolIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(IPConfigDetails, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_primary = kwargs.get('is_primary', None) - self.subnet_name = kwargs.get('subnet_name', None) - self.static_ip_address = kwargs.get('static_ip_address', None) - self.ip_address_type = kwargs.get('ip_address_type', None) - self.is_seleted_for_failover = kwargs.get('is_seleted_for_failover', None) - self.recovery_subnet_name = kwargs.get('recovery_subnet_name', None) - self.recovery_static_ip_address = kwargs.get('recovery_static_ip_address', None) - self.recovery_ip_address_type = kwargs.get('recovery_ip_address_type', None) - self.recovery_public_ip_address_id = kwargs.get('recovery_public_ip_address_id', None) - self.recovery_lb_backend_address_pool_ids = kwargs.get('recovery_lb_backend_address_pool_ids', None) - self.tfo_subnet_name = kwargs.get('tfo_subnet_name', None) - self.tfo_static_ip_address = kwargs.get('tfo_static_ip_address', None) - self.tfo_public_ip_address_id = kwargs.get('tfo_public_ip_address_id', None) - self.tfo_lb_backend_address_pool_ids = kwargs.get('tfo_lb_backend_address_pool_ids', None) - - -class IPConfigInputDetails(msrest.serialization.Model): - """IPConfigInputDetails. - - :param ip_config_name: - :type ip_config_name: str - :param is_primary: - :type is_primary: bool - :param is_seleted_for_failover: - :type is_seleted_for_failover: bool - :param recovery_subnet_name: - :type recovery_subnet_name: str - :param recovery_static_ip_address: - :type recovery_static_ip_address: str - :param recovery_public_ip_address_id: - :type recovery_public_ip_address_id: str - :param recovery_lb_backend_address_pool_ids: - :type recovery_lb_backend_address_pool_ids: list[str] - :param tfo_subnet_name: - :type tfo_subnet_name: str - :param tfo_static_ip_address: - :type tfo_static_ip_address: str - :param tfo_public_ip_address_id: - :type tfo_public_ip_address_id: str - :param tfo_lb_backend_address_pool_ids: - :type tfo_lb_backend_address_pool_ids: list[str] - """ - - _attribute_map = { - 'ip_config_name': {'key': 'ipConfigName', 'type': 'str'}, - 'is_primary': {'key': 'isPrimary', 'type': 'bool'}, - 'is_seleted_for_failover': {'key': 'isSeletedForFailover', 'type': 'bool'}, - 'recovery_subnet_name': {'key': 'recoverySubnetName', 'type': 'str'}, - 'recovery_static_ip_address': {'key': 'recoveryStaticIPAddress', 'type': 'str'}, - 'recovery_public_ip_address_id': {'key': 'recoveryPublicIPAddressId', 'type': 'str'}, - 'recovery_lb_backend_address_pool_ids': {'key': 'recoveryLBBackendAddressPoolIds', 'type': '[str]'}, - 'tfo_subnet_name': {'key': 'tfoSubnetName', 'type': 'str'}, - 'tfo_static_ip_address': {'key': 'tfoStaticIPAddress', 'type': 'str'}, - 'tfo_public_ip_address_id': {'key': 'tfoPublicIPAddressId', 'type': 'str'}, - 'tfo_lb_backend_address_pool_ids': {'key': 'tfoLBBackendAddressPoolIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(IPConfigInputDetails, self).__init__(**kwargs) - self.ip_config_name = kwargs.get('ip_config_name', None) - self.is_primary = kwargs.get('is_primary', None) - self.is_seleted_for_failover = kwargs.get('is_seleted_for_failover', None) - self.recovery_subnet_name = kwargs.get('recovery_subnet_name', None) - self.recovery_static_ip_address = kwargs.get('recovery_static_ip_address', None) - self.recovery_public_ip_address_id = kwargs.get('recovery_public_ip_address_id', None) - self.recovery_lb_backend_address_pool_ids = kwargs.get('recovery_lb_backend_address_pool_ids', None) - self.tfo_subnet_name = kwargs.get('tfo_subnet_name', None) - self.tfo_static_ip_address = kwargs.get('tfo_static_ip_address', None) - self.tfo_public_ip_address_id = kwargs.get('tfo_public_ip_address_id', None) - self.tfo_lb_backend_address_pool_ids = kwargs.get('tfo_lb_backend_address_pool_ids', None) - - -class Job(Resource): - """Job details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.JobProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'JobProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Job, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class JobCollection(msrest.serialization.Model): - """Collection of jobs. - - :param value: The list of jobs. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Job]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class JobEntity(msrest.serialization.Model): - """This class contains the minimal job details required to navigate to the desired drill down. - - :param job_id: The job id. - :type job_id: str - :param job_friendly_name: The job display name. - :type job_friendly_name: str - :param target_object_id: The object id. - :type target_object_id: str - :param target_object_name: The object name. - :type target_object_name: str - :param target_instance_type: The workflow affected object type. - :type target_instance_type: str - :param job_scenario_name: The job name. Enum type ScenarioName. - :type job_scenario_name: str - """ - - _attribute_map = { - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'job_friendly_name': {'key': 'jobFriendlyName', 'type': 'str'}, - 'target_object_id': {'key': 'targetObjectId', 'type': 'str'}, - 'target_object_name': {'key': 'targetObjectName', 'type': 'str'}, - 'target_instance_type': {'key': 'targetInstanceType', 'type': 'str'}, - 'job_scenario_name': {'key': 'jobScenarioName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobEntity, self).__init__(**kwargs) - self.job_id = kwargs.get('job_id', None) - self.job_friendly_name = kwargs.get('job_friendly_name', None) - self.target_object_id = kwargs.get('target_object_id', None) - self.target_object_name = kwargs.get('target_object_name', None) - self.target_instance_type = kwargs.get('target_instance_type', None) - self.job_scenario_name = kwargs.get('job_scenario_name', None) - - -class JobErrorDetails(msrest.serialization.Model): - """This class contains the error details per object. - - :param service_error_details: The Service error details. - :type service_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ServiceError - :param provider_error_details: The Provider error details. - :type provider_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ProviderError - :param error_level: Error level of error. - :type error_level: str - :param creation_time: The creation time of job error. - :type creation_time: ~datetime.datetime - :param task_id: The Id of the task. - :type task_id: str - """ - - _attribute_map = { - 'service_error_details': {'key': 'serviceErrorDetails', 'type': 'ServiceError'}, - 'provider_error_details': {'key': 'providerErrorDetails', 'type': 'ProviderError'}, - 'error_level': {'key': 'errorLevel', 'type': 'str'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'task_id': {'key': 'taskId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorDetails, self).__init__(**kwargs) - self.service_error_details = kwargs.get('service_error_details', None) - self.provider_error_details = kwargs.get('provider_error_details', None) - self.error_level = kwargs.get('error_level', None) - self.creation_time = kwargs.get('creation_time', None) - self.task_id = kwargs.get('task_id', None) - - -class JobProperties(msrest.serialization.Model): - """Job custom data details. - - :param activity_id: The activity id. - :type activity_id: str - :param scenario_name: The ScenarioName. - :type scenario_name: str - :param friendly_name: The DisplayName. - :type friendly_name: str - :param state: The status of the Job. It is one of these values - NotStarted, InProgress, - Succeeded, Failed, Cancelled, Suspended or Other. - :type state: str - :param state_description: The description of the state of the Job. For e.g. - For Succeeded - state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - :type state_description: str - :param tasks: The tasks. - :type tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :param errors: The errors. - :type errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] - :param start_time: The start time. - :type start_time: ~datetime.datetime - :param end_time: The end time. - :type end_time: ~datetime.datetime - :param allowed_actions: The Allowed action the job. - :type allowed_actions: list[str] - :param target_object_id: The affected Object Id. - :type target_object_id: str - :param target_object_name: The name of the affected object. - :type target_object_name: str - :param target_instance_type: The type of the affected object which is of - Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. - :type target_instance_type: str - :param custom_details: The custom job details like test failover job details. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.JobDetails - """ - - _attribute_map = { - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'scenario_name': {'key': 'scenarioName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'state_description': {'key': 'stateDescription', 'type': 'str'}, - 'tasks': {'key': 'tasks', 'type': '[ASRTask]'}, - 'errors': {'key': 'errors', 'type': '[JobErrorDetails]'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'allowed_actions': {'key': 'allowedActions', 'type': '[str]'}, - 'target_object_id': {'key': 'targetObjectId', 'type': 'str'}, - 'target_object_name': {'key': 'targetObjectName', 'type': 'str'}, - 'target_instance_type': {'key': 'targetInstanceType', 'type': 'str'}, - 'custom_details': {'key': 'customDetails', 'type': 'JobDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(JobProperties, self).__init__(**kwargs) - self.activity_id = kwargs.get('activity_id', None) - self.scenario_name = kwargs.get('scenario_name', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.state = kwargs.get('state', None) - self.state_description = kwargs.get('state_description', None) - self.tasks = kwargs.get('tasks', None) - self.errors = kwargs.get('errors', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.allowed_actions = kwargs.get('allowed_actions', None) - self.target_object_id = kwargs.get('target_object_id', None) - self.target_object_name = kwargs.get('target_object_name', None) - self.target_instance_type = kwargs.get('target_instance_type', None) - self.custom_details = kwargs.get('custom_details', None) - - -class JobQueryParameter(msrest.serialization.Model): - """Query parameter to enumerate jobs. - - :param start_time: Date time to get jobs from. - :type start_time: str - :param end_time: Date time to get jobs upto. - :type end_time: str - :param fabric_id: The Id of the fabric to search jobs under. - :type fabric_id: str - :param affected_object_types: The type of objects. - :type affected_object_types: str - :param job_status: The states of the job to be filtered can be in. - :type job_status: str - :param job_output_type: The output type of the jobs. Possible values include: "Json", "Xml", - "Excel". - :type job_output_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.ExportJobOutputSerializationType - :param job_name: The job Name. - :type job_name: str - :param timezone_offset: The timezone offset for the location of the request (in minutes). - :type timezone_offset: float - """ - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'end_time': {'key': 'endTime', 'type': 'str'}, - 'fabric_id': {'key': 'fabricId', 'type': 'str'}, - 'affected_object_types': {'key': 'affectedObjectTypes', 'type': 'str'}, - 'job_status': {'key': 'jobStatus', 'type': 'str'}, - 'job_output_type': {'key': 'jobOutputType', 'type': 'str'}, - 'job_name': {'key': 'jobName', 'type': 'str'}, - 'timezone_offset': {'key': 'timezoneOffset', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(JobQueryParameter, self).__init__(**kwargs) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.fabric_id = kwargs.get('fabric_id', None) - self.affected_object_types = kwargs.get('affected_object_types', None) - self.job_status = kwargs.get('job_status', None) - self.job_output_type = kwargs.get('job_output_type', None) - self.job_name = kwargs.get('job_name', None) - self.timezone_offset = kwargs.get('timezone_offset', None) - - -class JobStatusEventDetails(EventSpecificDetails): - """Model class for event details of a job status event. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param job_id: Job arm id for the event. - :type job_id: str - :param job_friendly_name: JobName for the Event. - :type job_friendly_name: str - :param job_status: JobStatus for the Event. - :type job_status: str - :param affected_object_type: AffectedObjectType for the event. - :type affected_object_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'job_friendly_name': {'key': 'jobFriendlyName', 'type': 'str'}, - 'job_status': {'key': 'jobStatus', 'type': 'str'}, - 'affected_object_type': {'key': 'affectedObjectType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobStatusEventDetails, self).__init__(**kwargs) - self.instance_type = 'JobStatus' # type: str - self.job_id = kwargs.get('job_id', None) - self.job_friendly_name = kwargs.get('job_friendly_name', None) - self.job_status = kwargs.get('job_status', None) - self.affected_object_type = kwargs.get('affected_object_type', None) - - -class KeyEncryptionKeyInfo(msrest.serialization.Model): - """Key Encryption Key (KEK) information. - - :param key_identifier: The key URL / identifier. - :type key_identifier: str - :param key_vault_resource_arm_id: The KeyVault resource ARM Id for key. - :type key_vault_resource_arm_id: str - """ - - _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'key_vault_resource_arm_id': {'key': 'keyVaultResourceArmId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyEncryptionKeyInfo, self).__init__(**kwargs) - self.key_identifier = kwargs.get('key_identifier', None) - self.key_vault_resource_arm_id = kwargs.get('key_vault_resource_arm_id', None) - - -class LogicalNetwork(Resource): - """Logical network data model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The Logical Network Properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LogicalNetworkProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(LogicalNetwork, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class LogicalNetworkCollection(msrest.serialization.Model): - """List of logical networks. - - :param value: The Logical Networks list details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[LogicalNetwork]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogicalNetworkCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class LogicalNetworkProperties(msrest.serialization.Model): - """Logical Network Properties. - - :param friendly_name: The Friendly Name. - :type friendly_name: str - :param network_virtualization_status: A value indicating whether Network Virtualization is - enabled for the logical network. - :type network_virtualization_status: str - :param logical_network_usage: A value indicating whether logical network is used as private - test network by test failover. - :type logical_network_usage: str - :param logical_network_definitions_status: A value indicating whether logical network - definitions are isolated. - :type logical_network_definitions_status: str - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'network_virtualization_status': {'key': 'networkVirtualizationStatus', 'type': 'str'}, - 'logical_network_usage': {'key': 'logicalNetworkUsage', 'type': 'str'}, - 'logical_network_definitions_status': {'key': 'logicalNetworkDefinitionsStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogicalNetworkProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.network_virtualization_status = kwargs.get('network_virtualization_status', None) - self.logical_network_usage = kwargs.get('logical_network_usage', None) - self.logical_network_definitions_status = kwargs.get('logical_network_definitions_status', None) - - -class ManualActionTaskDetails(TaskTypeDetails): - """This class represents the manual action task details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param name: The name. - :type name: str - :param instructions: The instructions. - :type instructions: str - :param observation: The observation. - :type observation: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'instructions': {'key': 'instructions', 'type': 'str'}, - 'observation': {'key': 'observation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManualActionTaskDetails, self).__init__(**kwargs) - self.instance_type = 'ManualActionTaskDetails' # type: str - self.name = kwargs.get('name', None) - self.instructions = kwargs.get('instructions', None) - self.observation = kwargs.get('observation', None) - - -class MarsAgentDetails(msrest.serialization.Model): - """Mars agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Mars agent Id. - :vartype id: str - :ivar name: The Mars agent name. - :vartype name: str - :ivar bios_id: The Mars agent Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The Mars agent Fqdn. - :vartype fqdn: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the Mars agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the Mars agent. Possible values include: "None", "Normal", - "Warning", "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - } - - def __init__( - self, - **kwargs - ): - super(MarsAgentDetails, self).__init__(**kwargs) - self.id = None - self.name = None - self.bios_id = None - self.fabric_object_id = None - self.fqdn = None - self.version = None - self.last_heartbeat_utc = None - self.health = None - self.health_errors = None - - -class MasterTargetServer(msrest.serialization.Model): - """Details of a Master Target Server. - - :param id: The server Id. - :type id: str - :param ip_address: The IP address of the server. - :type ip_address: str - :param name: The server name. - :type name: str - :param os_type: The OS type of the server. - :type os_type: str - :param agent_version: The version of the scout component on the server. - :type agent_version: str - :param last_heartbeat: The last heartbeat received from the server. - :type last_heartbeat: ~datetime.datetime - :param version_status: Version status. - :type version_status: str - :param retention_volumes: The retention volumes of Master target Server. - :type retention_volumes: list[~azure.mgmt.recoveryservicessiterecovery.models.RetentionVolume] - :param data_stores: The list of data stores in the fabric. - :type data_stores: list[~azure.mgmt.recoveryservicessiterecovery.models.DataStore] - :param validation_errors: Validation errors. - :type validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param health_errors: Health errors. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param disk_count: Disk count of the master target. - :type disk_count: int - :param os_version: OS Version of the master target. - :type os_version: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param mars_agent_version: MARS agent version. - :type mars_agent_version: str - :param mars_agent_expiry_date: MARS agent expiry date. - :type mars_agent_expiry_date: ~datetime.datetime - :param agent_version_details: Agent version details. - :type agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - :param mars_agent_version_details: Mars agent version details. - :type mars_agent_version_details: - ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'version_status': {'key': 'versionStatus', 'type': 'str'}, - 'retention_volumes': {'key': 'retentionVolumes', 'type': '[RetentionVolume]'}, - 'data_stores': {'key': 'dataStores', 'type': '[DataStore]'}, - 'validation_errors': {'key': 'validationErrors', 'type': '[HealthError]'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'disk_count': {'key': 'diskCount', 'type': 'int'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'mars_agent_version': {'key': 'marsAgentVersion', 'type': 'str'}, - 'mars_agent_expiry_date': {'key': 'marsAgentExpiryDate', 'type': 'iso-8601'}, - 'agent_version_details': {'key': 'agentVersionDetails', 'type': 'VersionDetails'}, - 'mars_agent_version_details': {'key': 'marsAgentVersionDetails', 'type': 'VersionDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(MasterTargetServer, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.ip_address = kwargs.get('ip_address', None) - self.name = kwargs.get('name', None) - self.os_type = kwargs.get('os_type', None) - self.agent_version = kwargs.get('agent_version', None) - self.last_heartbeat = kwargs.get('last_heartbeat', None) - self.version_status = kwargs.get('version_status', None) - self.retention_volumes = kwargs.get('retention_volumes', None) - self.data_stores = kwargs.get('data_stores', None) - self.validation_errors = kwargs.get('validation_errors', None) - self.health_errors = kwargs.get('health_errors', None) - self.disk_count = kwargs.get('disk_count', None) - self.os_version = kwargs.get('os_version', None) - self.agent_expiry_date = kwargs.get('agent_expiry_date', None) - self.mars_agent_version = kwargs.get('mars_agent_version', None) - self.mars_agent_expiry_date = kwargs.get('mars_agent_expiry_date', None) - self.agent_version_details = kwargs.get('agent_version_details', None) - self.mars_agent_version_details = kwargs.get('mars_agent_version_details', None) - - -class MigrateInput(msrest.serialization.Model): - """Input for migrate. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Migrate input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'MigrateInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrateInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class MigrateInputProperties(msrest.serialization.Model): - """Migrate input properties. - - All required parameters must be populated in order to send to Azure. - - :param provider_specific_details: Required. The provider specific details. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.MigrateProviderSpecificInput - """ - - _validation = { - 'provider_specific_details': {'required': True}, - } - - _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'MigrateProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrateInputProperties, self).__init__(**kwargs) - self.provider_specific_details = kwargs['provider_specific_details'] - - -class MigrateProviderSpecificInput(msrest.serialization.Model): - """Migrate provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtMigrateInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtMigrateInput'} - } - - def __init__( - self, - **kwargs - ): - super(MigrateProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class MigrationItem(Resource): - """Migration item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The migration item properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MigrationItemProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationItem, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class MigrationItemCollection(msrest.serialization.Model): - """Migration item collection. - - :param value: The list of migration items. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationItemCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class MigrationItemProperties(msrest.serialization.Model): - """Migration item properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar machine_name: The on-premise virtual machine name. - :vartype machine_name: str - :ivar policy_id: The ARM Id of policy governing this item. - :vartype policy_id: str - :ivar policy_friendly_name: The name of policy governing this item. - :vartype policy_friendly_name: str - :ivar migration_state: The migration status. Possible values include: "None", - "EnableMigrationInProgress", "EnableMigrationFailed", "DisableMigrationInProgress", - "DisableMigrationFailed", "InitialSeedingInProgress", "InitialSeedingFailed", "Replicating", - "MigrationInProgress", "MigrationSucceeded", "MigrationFailed". - :vartype migration_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.MigrationState - :ivar migration_state_description: The migration state description. - :vartype migration_state_description: str - :ivar last_test_migration_time: The last test migration time. - :vartype last_test_migration_time: ~datetime.datetime - :ivar last_test_migration_status: The status of the last test migration. - :vartype last_test_migration_status: str - :ivar test_migrate_state: The test migrate state. Possible values include: "None", - "TestMigrationInProgress", "TestMigrationSucceeded", "TestMigrationFailed", - "TestMigrationCleanupInProgress". - :vartype test_migrate_state: str or - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrationState - :ivar test_migrate_state_description: The test migrate state description. - :vartype test_migrate_state_description: str - :ivar health: The consolidated health. Possible values include: "None", "Normal", "Warning", - "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The list of health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar allowed_operations: The allowed operations on the migration item based on the current - migration state of the item. - :vartype allowed_operations: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemOperation] - :ivar current_job: The current job details. - :vartype current_job: ~azure.mgmt.recoveryservicessiterecovery.models.CurrentJobDetails - :ivar event_correlation_id: The correlation Id for events associated with this migration item. - :vartype event_correlation_id: str - :param provider_specific_details: The migration provider custom settings. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationProviderSpecificSettings - """ - - _validation = { - 'machine_name': {'readonly': True}, - 'policy_id': {'readonly': True}, - 'policy_friendly_name': {'readonly': True}, - 'migration_state': {'readonly': True}, - 'migration_state_description': {'readonly': True}, - 'last_test_migration_time': {'readonly': True}, - 'last_test_migration_status': {'readonly': True}, - 'test_migrate_state': {'readonly': True}, - 'test_migrate_state_description': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - 'allowed_operations': {'readonly': True}, - 'current_job': {'readonly': True}, - 'event_correlation_id': {'readonly': True}, - } - - _attribute_map = { - 'machine_name': {'key': 'machineName', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'policy_friendly_name': {'key': 'policyFriendlyName', 'type': 'str'}, - 'migration_state': {'key': 'migrationState', 'type': 'str'}, - 'migration_state_description': {'key': 'migrationStateDescription', 'type': 'str'}, - 'last_test_migration_time': {'key': 'lastTestMigrationTime', 'type': 'iso-8601'}, - 'last_test_migration_status': {'key': 'lastTestMigrationStatus', 'type': 'str'}, - 'test_migrate_state': {'key': 'testMigrateState', 'type': 'str'}, - 'test_migrate_state_description': {'key': 'testMigrateStateDescription', 'type': 'str'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'allowed_operations': {'key': 'allowedOperations', 'type': '[str]'}, - 'current_job': {'key': 'currentJob', 'type': 'CurrentJobDetails'}, - 'event_correlation_id': {'key': 'eventCorrelationId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'MigrationProviderSpecificSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationItemProperties, self).__init__(**kwargs) - self.machine_name = None - self.policy_id = None - self.policy_friendly_name = None - self.migration_state = None - self.migration_state_description = None - self.last_test_migration_time = None - self.last_test_migration_status = None - self.test_migrate_state = None - self.test_migrate_state_description = None - self.health = None - self.health_errors = None - self.allowed_operations = None - self.current_job = None - self.event_correlation_id = None - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class MigrationItemsQueryParameter(msrest.serialization.Model): - """Query parameter to enumerate migration items. - - :param source_fabric_name: The source fabric name filter. - :type source_fabric_name: str - :param source_container_name: The source container name filter. - :type source_container_name: str - :param instance_type: The replication provider type. - :type instance_type: str - """ - - _attribute_map = { - 'source_fabric_name': {'key': 'sourceFabricName', 'type': 'str'}, - 'source_container_name': {'key': 'sourceContainerName', 'type': 'str'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationItemsQueryParameter, self).__init__(**kwargs) - self.source_fabric_name = kwargs.get('source_fabric_name', None) - self.source_container_name = kwargs.get('source_container_name', None) - self.instance_type = kwargs.get('instance_type', None) - - -class MigrationProviderSpecificSettings(msrest.serialization.Model): - """Migration provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtMigrationDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtMigrationDetails'} - } - - def __init__( - self, - **kwargs - ): - super(MigrationProviderSpecificSettings, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class MigrationRecoveryPoint(Resource): - """Recovery point for a migration item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Recovery point properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MigrationRecoveryPointProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationRecoveryPoint, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class MigrationRecoveryPointCollection(msrest.serialization.Model): - """Collection of migration recovery points. - - :param value: The migration recovery point details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationRecoveryPoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationRecoveryPointCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class MigrationRecoveryPointProperties(msrest.serialization.Model): - """Migration item recovery point properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recovery_point_time: The recovery point time. - :vartype recovery_point_time: ~datetime.datetime - :ivar recovery_point_type: The recovery point type. Possible values include: "NotSpecified", - "ApplicationConsistent", "CrashConsistent". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointType - """ - - _validation = { - 'recovery_point_time': {'readonly': True}, - 'recovery_point_type': {'readonly': True}, - } - - _attribute_map = { - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationRecoveryPointProperties, self).__init__(**kwargs) - self.recovery_point_time = None - self.recovery_point_type = None - - -class MobilityServiceUpdate(msrest.serialization.Model): - """The Mobility Service update details. - - :param version: The version of the latest update. - :type version: str - :param reboot_status: The reboot status of the update - whether it is required or not. - :type reboot_status: str - :param os_type: The OS type. - :type os_type: str - """ - - _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'reboot_status': {'key': 'rebootStatus', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MobilityServiceUpdate, self).__init__(**kwargs) - self.version = kwargs.get('version', None) - self.reboot_status = kwargs.get('reboot_status', None) - self.os_type = kwargs.get('os_type', None) - - -class Network(Resource): - """Network model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The Network Properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'NetworkProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Network, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class NetworkCollection(msrest.serialization.Model): - """List of networks. - - :param value: The Networks list details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Network] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Network]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class NetworkMapping(Resource): - """Network Mapping model. Ideally it should have been possible to inherit this class from prev version in InheritedModels as long as there is no difference in structure or method signature. Since there were no base Models for certain fields and methods viz NetworkMappingProperties and Load with required return type, the class has been introduced in its entirety with references to base models to facilitate extensions in subsequent versions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The Network Mapping Properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'NetworkMappingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkMapping, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class NetworkMappingCollection(msrest.serialization.Model): - """List of network mappings. As with NetworkMapping, it should be possible to reuse a prev version of this class. It doesn't seem likely this class could be anything more than a slightly bespoke collection of NetworkMapping. Hence it makes sense to override Load with Base.NetworkMapping instead of existing CurrentVersion.NetworkMapping. - - :param value: The Network Mappings list. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkMapping]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkMappingCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class NetworkMappingProperties(msrest.serialization.Model): - """Network Mapping Properties. - - :param state: The pairing state for network mapping. - :type state: str - :param primary_network_friendly_name: The primary network friendly name. - :type primary_network_friendly_name: str - :param primary_network_id: The primary network id for network mapping. - :type primary_network_id: str - :param primary_fabric_friendly_name: The primary fabric friendly name. - :type primary_fabric_friendly_name: str - :param recovery_network_friendly_name: The recovery network friendly name. - :type recovery_network_friendly_name: str - :param recovery_network_id: The recovery network id for network mapping. - :type recovery_network_id: str - :param recovery_fabric_arm_id: The recovery fabric ARM id. - :type recovery_fabric_arm_id: str - :param recovery_fabric_friendly_name: The recovery fabric friendly name. - :type recovery_fabric_friendly_name: str - :param fabric_specific_settings: The fabric specific settings. - :type fabric_specific_settings: - ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings - """ - - _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - 'primary_network_friendly_name': {'key': 'primaryNetworkFriendlyName', 'type': 'str'}, - 'primary_network_id': {'key': 'primaryNetworkId', 'type': 'str'}, - 'primary_fabric_friendly_name': {'key': 'primaryFabricFriendlyName', 'type': 'str'}, - 'recovery_network_friendly_name': {'key': 'recoveryNetworkFriendlyName', 'type': 'str'}, - 'recovery_network_id': {'key': 'recoveryNetworkId', 'type': 'str'}, - 'recovery_fabric_arm_id': {'key': 'recoveryFabricArmId', 'type': 'str'}, - 'recovery_fabric_friendly_name': {'key': 'recoveryFabricFriendlyName', 'type': 'str'}, - 'fabric_specific_settings': {'key': 'fabricSpecificSettings', 'type': 'NetworkMappingFabricSpecificSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkMappingProperties, self).__init__(**kwargs) - self.state = kwargs.get('state', None) - self.primary_network_friendly_name = kwargs.get('primary_network_friendly_name', None) - self.primary_network_id = kwargs.get('primary_network_id', None) - self.primary_fabric_friendly_name = kwargs.get('primary_fabric_friendly_name', None) - self.recovery_network_friendly_name = kwargs.get('recovery_network_friendly_name', None) - self.recovery_network_id = kwargs.get('recovery_network_id', None) - self.recovery_fabric_arm_id = kwargs.get('recovery_fabric_arm_id', None) - self.recovery_fabric_friendly_name = kwargs.get('recovery_fabric_friendly_name', None) - self.fabric_specific_settings = kwargs.get('fabric_specific_settings', None) - - -class NetworkProperties(msrest.serialization.Model): - """Network Properties. - - :param fabric_type: The Fabric Type. - :type fabric_type: str - :param subnets: The List of subnets. - :type subnets: list[~azure.mgmt.recoveryservicessiterecovery.models.Subnet] - :param friendly_name: The Friendly Name. - :type friendly_name: str - :param network_type: The Network Type. - :type network_type: str - """ - - _attribute_map = { - 'fabric_type': {'key': 'fabricType', 'type': 'str'}, - 'subnets': {'key': 'subnets', 'type': '[Subnet]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'network_type': {'key': 'networkType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkProperties, self).__init__(**kwargs) - self.fabric_type = kwargs.get('fabric_type', None) - self.subnets = kwargs.get('subnets', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.network_type = kwargs.get('network_type', None) - - -class NewProtectionProfile(ProtectionProfileCustomDetails): - """New Protection profile input. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param policy_name: Required. The protection profile input. - :type policy_name: str - :param recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :type recovery_point_history: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: Required. A value indicating whether multi-VM sync has to be - enabled. Value should be 'Enabled' or 'Disabled'. Possible values include: "Enable", "Disable". - :type multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - - _validation = { - 'resource_type': {'required': True}, - 'policy_name': {'required': True}, - 'multi_vm_sync_status': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NewProtectionProfile, self).__init__(**kwargs) - self.resource_type = 'New' # type: str - self.policy_name = kwargs['policy_name'] - self.recovery_point_history = kwargs.get('recovery_point_history', None) - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.multi_vm_sync_status = kwargs['multi_vm_sync_status'] - - -class NewRecoveryVirtualNetwork(RecoveryVirtualNetworkCustomDetails): - """Recovery virtual network input to create new virtual network from given source network. - - All required parameters must be populated in order to send to Azure. - - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_virtual_network_resource_group_name: The name of the resource group to be used - to create the recovery virtual network. If absent, target network would be created in the same - resource group as target VM. - :type recovery_virtual_network_resource_group_name: str - :param recovery_virtual_network_name: The recovery virtual network name. - :type recovery_virtual_network_name: str - """ - - _validation = { - 'resource_type': {'required': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_virtual_network_resource_group_name': {'key': 'recoveryVirtualNetworkResourceGroupName', 'type': 'str'}, - 'recovery_virtual_network_name': {'key': 'recoveryVirtualNetworkName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NewRecoveryVirtualNetwork, self).__init__(**kwargs) - self.resource_type = 'New' # type: str - self.recovery_virtual_network_resource_group_name = kwargs.get('recovery_virtual_network_resource_group_name', None) - self.recovery_virtual_network_name = kwargs.get('recovery_virtual_network_name', None) - - -class OperationsDiscovery(msrest.serialization.Model): - """Operations discovery class. - - :param name: Name of the API. The name of the operation being performed on this particular - object. It should match the action name that appears in RBAC / the event service. Examples of - operations include: * Microsoft.Compute/virtualMachine/capture/action * - Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * - Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action - should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the - action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or - Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, - Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be - used. If it is a POST, Action should be used. As a note: all resource providers would need to - include the "{Resource Provider Namespace}/register/action" operation in their response. This - API is used to register for their service, and should include details about the operation (e.g. - a localized name for the resource provider + any special considerations like PII release). - :type name: str - :param display: Object type. - :type display: ~azure.mgmt.recoveryservicessiterecovery.models.Display - :param origin: Origin. The intended executor of the operation; governs the display of the - operation in the RBAC UX and the audit logs UX. Default value is "user,system". - :type origin: str - :param properties: Properties. Reserved for future use. - :type properties: any - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'Display'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsDiscovery, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class OperationsDiscoveryCollection(msrest.serialization.Model): - """Collection of ClientDiscovery details. - - :param value: The ClientDiscovery details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationsDiscovery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsDiscoveryCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OSDetails(msrest.serialization.Model): - """Disk Details. - - :param os_type: VM Disk details. - :type os_type: str - :param product_type: Product type. - :type product_type: str - :param os_edition: The OSEdition. - :type os_edition: str - :param o_s_version: The OS Version. - :type o_s_version: str - :param o_s_major_version: The OS Major Version. - :type o_s_major_version: str - :param o_s_minor_version: The OS Minor Version. - :type o_s_minor_version: str - """ - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'product_type': {'key': 'productType', 'type': 'str'}, - 'os_edition': {'key': 'osEdition', 'type': 'str'}, - 'o_s_version': {'key': 'oSVersion', 'type': 'str'}, - 'o_s_major_version': {'key': 'oSMajorVersion', 'type': 'str'}, - 'o_s_minor_version': {'key': 'oSMinorVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OSDetails, self).__init__(**kwargs) - self.os_type = kwargs.get('os_type', None) - self.product_type = kwargs.get('product_type', None) - self.os_edition = kwargs.get('os_edition', None) - self.o_s_version = kwargs.get('o_s_version', None) - self.o_s_major_version = kwargs.get('o_s_major_version', None) - self.o_s_minor_version = kwargs.get('o_s_minor_version', None) - - -class OSDiskDetails(msrest.serialization.Model): - """Details of the OS Disk. - - :param os_vhd_id: The id of the disk containing the OS. - :type os_vhd_id: str - :param os_type: The type of the OS on the VM. - :type os_type: str - :param vhd_name: The OS disk VHD name. - :type vhd_name: str - """ - - _attribute_map = { - 'os_vhd_id': {'key': 'osVhdId', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vhd_name': {'key': 'vhdName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OSDiskDetails, self).__init__(**kwargs) - self.os_vhd_id = kwargs.get('os_vhd_id', None) - self.os_type = kwargs.get('os_type', None) - self.vhd_name = kwargs.get('vhd_name', None) - - -class OSVersionWrapper(msrest.serialization.Model): - """Wrapper model for OSVersion to include version and service pack info. - - :param version: The version. - :type version: str - :param service_pack: The service pack. - :type service_pack: str - """ - - _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'service_pack': {'key': 'servicePack', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OSVersionWrapper, self).__init__(**kwargs) - self.version = kwargs.get('version', None) - self.service_pack = kwargs.get('service_pack', None) - - -class PlannedFailoverInput(msrest.serialization.Model): - """Input definition for planned failover. - - :param properties: Planned failover input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'PlannedFailoverInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PlannedFailoverInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class PlannedFailoverInputProperties(msrest.serialization.Model): - """Input definition for planned failover input properties. - - :param failover_direction: Failover direction. - :type failover_direction: str - :param provider_specific_details: Provider specific settings. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput - """ - - _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'PlannedFailoverProviderSpecificFailoverInput'}, - } - - def __init__( - self, - **kwargs - ): - super(PlannedFailoverInputProperties, self).__init__(**kwargs) - self.failover_direction = kwargs.get('failover_direction', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class Policy(Resource): - """Protection profile details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PolicyProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Policy, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class PolicyCollection(msrest.serialization.Model): - """Protection Profile Collection details. - - :param value: The policy details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Policy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PolicyCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PolicyProperties(msrest.serialization.Model): - """Protection profile custom data details. - - :param friendly_name: The FriendlyName. - :type friendly_name: str - :param provider_specific_details: The ReplicationChannelSetting. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'PolicyProviderSpecificDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(PolicyProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class ProcessServer(msrest.serialization.Model): - """Details of the Process Server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param friendly_name: The Process Server's friendly name. - :type friendly_name: str - :param id: The Process Server Id. - :type id: str - :param ip_address: The IP address of the server. - :type ip_address: str - :param os_type: The OS type of the server. - :type os_type: str - :param agent_version: The version of the scout component on the server. - :type agent_version: str - :param last_heartbeat: The last heartbeat received from the server. - :type last_heartbeat: ~datetime.datetime - :param version_status: Version status. - :type version_status: str - :param mobility_service_updates: The list of the mobility service updates available on the - Process Server. - :type mobility_service_updates: - list[~azure.mgmt.recoveryservicessiterecovery.models.MobilityServiceUpdate] - :param host_id: The agent generated Id. - :type host_id: str - :param machine_count: The servers configured with this PS. - :type machine_count: str - :param replication_pair_count: The number of replication pairs configured in this PS. - :type replication_pair_count: str - :param system_load: The percentage of the system load. - :type system_load: str - :param system_load_status: The system load status. - :type system_load_status: str - :param cpu_load: The percentage of the CPU load. - :type cpu_load: str - :param cpu_load_status: The CPU load status. - :type cpu_load_status: str - :param total_memory_in_bytes: The total memory. - :type total_memory_in_bytes: long - :param available_memory_in_bytes: The available memory. - :type available_memory_in_bytes: long - :param memory_usage_status: The memory usage status. - :type memory_usage_status: str - :param total_space_in_bytes: The total space. - :type total_space_in_bytes: long - :param available_space_in_bytes: The available space. - :type available_space_in_bytes: long - :param space_usage_status: The space usage status. - :type space_usage_status: str - :param ps_service_status: The PS service status. - :type ps_service_status: str - :param ssl_cert_expiry_date: The PS SSL cert expiry date. - :type ssl_cert_expiry_date: ~datetime.datetime - :param ssl_cert_expiry_remaining_days: CS SSL cert expiry date. - :type ssl_cert_expiry_remaining_days: int - :param os_version: OS Version of the process server. Note: This will get populated if user has - CS version greater than 9.12.0.0. - :type os_version: str - :param health_errors: Health errors. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param agent_version_details: The agent version details. - :type agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - :ivar health: The health of Process Server. Possible values include: "None", "Normal", - "Warning", "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar ps_stats_refresh_time: The process server stats refresh time. - :vartype ps_stats_refresh_time: ~datetime.datetime - :ivar throughput_upload_pending_data_in_bytes: The uploading pending data in bytes. - :vartype throughput_upload_pending_data_in_bytes: long - :ivar throughput_in_m_bps: The throughput in MBps. - :vartype throughput_in_m_bps: long - :ivar throughput_in_bytes: The throughput in bytes. - :vartype throughput_in_bytes: long - :ivar throughput_status: The throughput status. - :vartype throughput_status: str - :ivar mars_communication_status: The MARS communication status. - :vartype mars_communication_status: str - :ivar mars_registration_status: The MARS registration status. - :vartype mars_registration_status: str - """ - - _validation = { - 'health': {'readonly': True}, - 'ps_stats_refresh_time': {'readonly': True}, - 'throughput_upload_pending_data_in_bytes': {'readonly': True}, - 'throughput_in_m_bps': {'readonly': True}, - 'throughput_in_bytes': {'readonly': True}, - 'throughput_status': {'readonly': True}, - 'mars_communication_status': {'readonly': True}, - 'mars_registration_status': {'readonly': True}, - } - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'version_status': {'key': 'versionStatus', 'type': 'str'}, - 'mobility_service_updates': {'key': 'mobilityServiceUpdates', 'type': '[MobilityServiceUpdate]'}, - 'host_id': {'key': 'hostId', 'type': 'str'}, - 'machine_count': {'key': 'machineCount', 'type': 'str'}, - 'replication_pair_count': {'key': 'replicationPairCount', 'type': 'str'}, - 'system_load': {'key': 'systemLoad', 'type': 'str'}, - 'system_load_status': {'key': 'systemLoadStatus', 'type': 'str'}, - 'cpu_load': {'key': 'cpuLoad', 'type': 'str'}, - 'cpu_load_status': {'key': 'cpuLoadStatus', 'type': 'str'}, - 'total_memory_in_bytes': {'key': 'totalMemoryInBytes', 'type': 'long'}, - 'available_memory_in_bytes': {'key': 'availableMemoryInBytes', 'type': 'long'}, - 'memory_usage_status': {'key': 'memoryUsageStatus', 'type': 'str'}, - 'total_space_in_bytes': {'key': 'totalSpaceInBytes', 'type': 'long'}, - 'available_space_in_bytes': {'key': 'availableSpaceInBytes', 'type': 'long'}, - 'space_usage_status': {'key': 'spaceUsageStatus', 'type': 'str'}, - 'ps_service_status': {'key': 'psServiceStatus', 'type': 'str'}, - 'ssl_cert_expiry_date': {'key': 'sslCertExpiryDate', 'type': 'iso-8601'}, - 'ssl_cert_expiry_remaining_days': {'key': 'sslCertExpiryRemainingDays', 'type': 'int'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'agent_version_details': {'key': 'agentVersionDetails', 'type': 'VersionDetails'}, - 'health': {'key': 'health', 'type': 'str'}, - 'ps_stats_refresh_time': {'key': 'psStatsRefreshTime', 'type': 'iso-8601'}, - 'throughput_upload_pending_data_in_bytes': {'key': 'throughputUploadPendingDataInBytes', 'type': 'long'}, - 'throughput_in_m_bps': {'key': 'throughputInMBps', 'type': 'long'}, - 'throughput_in_bytes': {'key': 'throughputInBytes', 'type': 'long'}, - 'throughput_status': {'key': 'throughputStatus', 'type': 'str'}, - 'mars_communication_status': {'key': 'marsCommunicationStatus', 'type': 'str'}, - 'mars_registration_status': {'key': 'marsRegistrationStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProcessServer, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.id = kwargs.get('id', None) - self.ip_address = kwargs.get('ip_address', None) - self.os_type = kwargs.get('os_type', None) - self.agent_version = kwargs.get('agent_version', None) - self.last_heartbeat = kwargs.get('last_heartbeat', None) - self.version_status = kwargs.get('version_status', None) - self.mobility_service_updates = kwargs.get('mobility_service_updates', None) - self.host_id = kwargs.get('host_id', None) - self.machine_count = kwargs.get('machine_count', None) - self.replication_pair_count = kwargs.get('replication_pair_count', None) - self.system_load = kwargs.get('system_load', None) - self.system_load_status = kwargs.get('system_load_status', None) - self.cpu_load = kwargs.get('cpu_load', None) - self.cpu_load_status = kwargs.get('cpu_load_status', None) - self.total_memory_in_bytes = kwargs.get('total_memory_in_bytes', None) - self.available_memory_in_bytes = kwargs.get('available_memory_in_bytes', None) - self.memory_usage_status = kwargs.get('memory_usage_status', None) - self.total_space_in_bytes = kwargs.get('total_space_in_bytes', None) - self.available_space_in_bytes = kwargs.get('available_space_in_bytes', None) - self.space_usage_status = kwargs.get('space_usage_status', None) - self.ps_service_status = kwargs.get('ps_service_status', None) - self.ssl_cert_expiry_date = kwargs.get('ssl_cert_expiry_date', None) - self.ssl_cert_expiry_remaining_days = kwargs.get('ssl_cert_expiry_remaining_days', None) - self.os_version = kwargs.get('os_version', None) - self.health_errors = kwargs.get('health_errors', None) - self.agent_expiry_date = kwargs.get('agent_expiry_date', None) - self.agent_version_details = kwargs.get('agent_version_details', None) - self.health = None - self.ps_stats_refresh_time = None - self.throughput_upload_pending_data_in_bytes = None - self.throughput_in_m_bps = None - self.throughput_in_bytes = None - self.throughput_status = None - self.mars_communication_status = None - self.mars_registration_status = None - - -class ProcessServerDetails(msrest.serialization.Model): - """Process server details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The process server Id. - :vartype id: str - :ivar name: The process server name. - :vartype name: str - :ivar bios_id: The process server Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The process server Fqdn. - :vartype fqdn: str - :ivar ip_addresses: The list of IP addresses for communicating with the RCM component. - :vartype ip_addresses: list[str] - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the process server. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar total_memory_in_bytes: The total memory. - :vartype total_memory_in_bytes: long - :ivar available_memory_in_bytes: The available memory. - :vartype available_memory_in_bytes: long - :ivar used_memory_in_bytes: The used memory. - :vartype used_memory_in_bytes: long - :ivar memory_usage_percentage: The memory usage percentage. - :vartype memory_usage_percentage: float - :ivar total_space_in_bytes: The total disk space. - :vartype total_space_in_bytes: long - :ivar available_space_in_bytes: The available disk space. - :vartype available_space_in_bytes: long - :ivar used_space_in_bytes: The used disk space. - :vartype used_space_in_bytes: long - :ivar free_space_percentage: The free disk space percentage. - :vartype free_space_percentage: float - :ivar throughput_upload_pending_data_in_bytes: The uploading pending data in bytes. - :vartype throughput_upload_pending_data_in_bytes: long - :ivar throughput_in_bytes: The throughput in bytes. - :vartype throughput_in_bytes: long - :ivar processor_usage_percentage: The processor usage percentage. - :vartype processor_usage_percentage: float - :ivar throughput_status: The throughput status. Possible values include: "Healthy", "Warning", - "Critical", "Unknown". - :vartype throughput_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar system_load: The system load. - :vartype system_load: long - :ivar system_load_status: The system load status. Possible values include: "Healthy", - "Warning", "Critical", "Unknown". - :vartype system_load_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar disk_usage_status: The disk usage status. Possible values include: "Healthy", "Warning", - "Critical", "Unknown". - :vartype disk_usage_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar memory_usage_status: The memory usage status. Possible values include: "Healthy", - "Warning", "Critical", "Unknown". - :vartype memory_usage_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar processor_usage_status: The processor usage status. Possible values include: "Healthy", - "Warning", "Critical", "Unknown". - :vartype processor_usage_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar health: The health of the process server. Possible values include: "None", "Normal", - "Warning", "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar protected_item_count: The protected item count. - :vartype protected_item_count: int - :ivar historic_health: The historic health of the process server based on the health in last 24 - hours. Possible values include: "None", "Normal", "Warning", "Critical". - :vartype historic_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'ip_addresses': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'total_memory_in_bytes': {'readonly': True}, - 'available_memory_in_bytes': {'readonly': True}, - 'used_memory_in_bytes': {'readonly': True}, - 'memory_usage_percentage': {'readonly': True}, - 'total_space_in_bytes': {'readonly': True}, - 'available_space_in_bytes': {'readonly': True}, - 'used_space_in_bytes': {'readonly': True}, - 'free_space_percentage': {'readonly': True}, - 'throughput_upload_pending_data_in_bytes': {'readonly': True}, - 'throughput_in_bytes': {'readonly': True}, - 'processor_usage_percentage': {'readonly': True}, - 'throughput_status': {'readonly': True}, - 'system_load': {'readonly': True}, - 'system_load_status': {'readonly': True}, - 'disk_usage_status': {'readonly': True}, - 'memory_usage_status': {'readonly': True}, - 'processor_usage_status': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - 'protected_item_count': {'readonly': True}, - 'historic_health': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'total_memory_in_bytes': {'key': 'totalMemoryInBytes', 'type': 'long'}, - 'available_memory_in_bytes': {'key': 'availableMemoryInBytes', 'type': 'long'}, - 'used_memory_in_bytes': {'key': 'usedMemoryInBytes', 'type': 'long'}, - 'memory_usage_percentage': {'key': 'memoryUsagePercentage', 'type': 'float'}, - 'total_space_in_bytes': {'key': 'totalSpaceInBytes', 'type': 'long'}, - 'available_space_in_bytes': {'key': 'availableSpaceInBytes', 'type': 'long'}, - 'used_space_in_bytes': {'key': 'usedSpaceInBytes', 'type': 'long'}, - 'free_space_percentage': {'key': 'freeSpacePercentage', 'type': 'float'}, - 'throughput_upload_pending_data_in_bytes': {'key': 'throughputUploadPendingDataInBytes', 'type': 'long'}, - 'throughput_in_bytes': {'key': 'throughputInBytes', 'type': 'long'}, - 'processor_usage_percentage': {'key': 'processorUsagePercentage', 'type': 'float'}, - 'throughput_status': {'key': 'throughputStatus', 'type': 'str'}, - 'system_load': {'key': 'systemLoad', 'type': 'long'}, - 'system_load_status': {'key': 'systemLoadStatus', 'type': 'str'}, - 'disk_usage_status': {'key': 'diskUsageStatus', 'type': 'str'}, - 'memory_usage_status': {'key': 'memoryUsageStatus', 'type': 'str'}, - 'processor_usage_status': {'key': 'processorUsageStatus', 'type': 'str'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'int'}, - 'historic_health': {'key': 'historicHealth', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProcessServerDetails, self).__init__(**kwargs) - self.id = None - self.name = None - self.bios_id = None - self.fabric_object_id = None - self.fqdn = None - self.ip_addresses = None - self.version = None - self.last_heartbeat_utc = None - self.total_memory_in_bytes = None - self.available_memory_in_bytes = None - self.used_memory_in_bytes = None - self.memory_usage_percentage = None - self.total_space_in_bytes = None - self.available_space_in_bytes = None - self.used_space_in_bytes = None - self.free_space_percentage = None - self.throughput_upload_pending_data_in_bytes = None - self.throughput_in_bytes = None - self.processor_usage_percentage = None - self.throughput_status = None - self.system_load = None - self.system_load_status = None - self.disk_usage_status = None - self.memory_usage_status = None - self.processor_usage_status = None - self.health = None - self.health_errors = None - self.protected_item_count = None - self.historic_health = None - - -class ProtectableItem(Resource): - """Replication protected item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectableItemProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectableItem, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ProtectableItemCollection(msrest.serialization.Model): - """Protectable item collection. - - :param value: The Protectable item details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ProtectableItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectableItemCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ProtectableItemProperties(msrest.serialization.Model): - """Replication protected item custom data details. - - :param friendly_name: The name. - :type friendly_name: str - :param protection_status: The protection status. - :type protection_status: str - :param replication_protected_item_id: The ARM resource of protected items. - :type replication_protected_item_id: str - :param recovery_services_provider_id: The recovery provider ARM Id. - :type recovery_services_provider_id: str - :param protection_readiness_errors: The Current protection readiness errors. - :type protection_readiness_errors: list[str] - :param supported_replication_providers: The list of replication providers supported for the - protectable item. - :type supported_replication_providers: list[str] - :param custom_details: The Replication provider custom settings. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigurationSettings - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'replication_protected_item_id': {'key': 'replicationProtectedItemId', 'type': 'str'}, - 'recovery_services_provider_id': {'key': 'recoveryServicesProviderId', 'type': 'str'}, - 'protection_readiness_errors': {'key': 'protectionReadinessErrors', 'type': '[str]'}, - 'supported_replication_providers': {'key': 'supportedReplicationProviders', 'type': '[str]'}, - 'custom_details': {'key': 'customDetails', 'type': 'ConfigurationSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectableItemProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.protection_status = kwargs.get('protection_status', None) - self.replication_protected_item_id = kwargs.get('replication_protected_item_id', None) - self.recovery_services_provider_id = kwargs.get('recovery_services_provider_id', None) - self.protection_readiness_errors = kwargs.get('protection_readiness_errors', None) - self.supported_replication_providers = kwargs.get('supported_replication_providers', None) - self.custom_details = kwargs.get('custom_details', None) - - -class ProtectableItemQueryParameter(msrest.serialization.Model): - """Query parameter to enumerate Protectable items. - - :param state: State of the Protectable item query filter. - :type state: str - """ - - _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectableItemQueryParameter, self).__init__(**kwargs) - self.state = kwargs.get('state', None) - - -class ProtectedItemsQueryParameter(msrest.serialization.Model): - """Query parameter to enumerate protected items. - - :param source_fabric_name: The source fabric name filter. - :type source_fabric_name: str - :param recovery_plan_name: The recovery plan filter. - :type recovery_plan_name: str - :param source_fabric_location: The source fabric location filter. - :type source_fabric_location: str - :param fabric_object_id: The fabric object Id filter. - :type fabric_object_id: str - :param v_center_name: The vCenter name filter. - :type v_center_name: str - :param instance_type: The replication provider type. - :type instance_type: str - :param multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Possible values include: "AutoCreated", "UserSpecified". - :type multi_vm_group_create_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :param process_server_id: The process server Id filter. - :type process_server_id: str - """ - - _attribute_map = { - 'source_fabric_name': {'key': 'sourceFabricName', 'type': 'str'}, - 'recovery_plan_name': {'key': 'recoveryPlanName', 'type': 'str'}, - 'source_fabric_location': {'key': 'sourceFabricLocation', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'v_center_name': {'key': 'vCenterName', 'type': 'str'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'multi_vm_group_create_option': {'key': 'multiVmGroupCreateOption', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectedItemsQueryParameter, self).__init__(**kwargs) - self.source_fabric_name = kwargs.get('source_fabric_name', None) - self.recovery_plan_name = kwargs.get('recovery_plan_name', None) - self.source_fabric_location = kwargs.get('source_fabric_location', None) - self.fabric_object_id = kwargs.get('fabric_object_id', None) - self.v_center_name = kwargs.get('v_center_name', None) - self.instance_type = kwargs.get('instance_type', None) - self.multi_vm_group_create_option = kwargs.get('multi_vm_group_create_option', None) - self.process_server_id = kwargs.get('process_server_id', None) - - -class ProtectionContainer(Resource): - """Protection container details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectionContainerProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectionContainer, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ProtectionContainerCollection(msrest.serialization.Model): - """Protection Container collection. - - :param value: The Protection Container details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ProtectionContainer]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectionContainerCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ProtectionContainerFabricSpecificDetails(msrest.serialization.Model): - """Base class for fabric specific details of container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar instance_type: Gets the class type. Overridden in derived classes. - :vartype instance_type: str - """ - - _validation = { - 'instance_type': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectionContainerFabricSpecificDetails, self).__init__(**kwargs) - self.instance_type = None - - -class ProtectionContainerMapping(Resource): - """Protection container mapping object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectionContainerMappingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectionContainerMapping, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ProtectionContainerMappingCollection(msrest.serialization.Model): - """Protection container mapping collection class. - - :param value: List of container mappings. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :param next_link: Link to fetch rest of the data. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ProtectionContainerMapping]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectionContainerMappingCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ProtectionContainerMappingProperties(msrest.serialization.Model): - """Protection container mapping properties. - - :param target_protection_container_id: Paired protection container ARM ID. - :type target_protection_container_id: str - :param target_protection_container_friendly_name: Friendly name of paired container. - :type target_protection_container_friendly_name: str - :param provider_specific_details: Provider specific provider details. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProviderSpecificDetails - :param health: Health of pairing. - :type health: str - :param health_error_details: Health error. - :type health_error_details: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param policy_id: Policy ARM Id. - :type policy_id: str - :param state: Association Status. - :type state: str - :param source_protection_container_friendly_name: Friendly name of source protection container. - :type source_protection_container_friendly_name: str - :param source_fabric_friendly_name: Friendly name of source fabric. - :type source_fabric_friendly_name: str - :param target_fabric_friendly_name: Friendly name of target fabric. - :type target_fabric_friendly_name: str - :param policy_friendly_name: Friendly name of replication policy. - :type policy_friendly_name: str - """ - - _attribute_map = { - 'target_protection_container_id': {'key': 'targetProtectionContainerId', 'type': 'str'}, - 'target_protection_container_friendly_name': {'key': 'targetProtectionContainerFriendlyName', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ProtectionContainerMappingProviderSpecificDetails'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_error_details': {'key': 'healthErrorDetails', 'type': '[HealthError]'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'source_protection_container_friendly_name': {'key': 'sourceProtectionContainerFriendlyName', 'type': 'str'}, - 'source_fabric_friendly_name': {'key': 'sourceFabricFriendlyName', 'type': 'str'}, - 'target_fabric_friendly_name': {'key': 'targetFabricFriendlyName', 'type': 'str'}, - 'policy_friendly_name': {'key': 'policyFriendlyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectionContainerMappingProperties, self).__init__(**kwargs) - self.target_protection_container_id = kwargs.get('target_protection_container_id', None) - self.target_protection_container_friendly_name = kwargs.get('target_protection_container_friendly_name', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - self.health = kwargs.get('health', None) - self.health_error_details = kwargs.get('health_error_details', None) - self.policy_id = kwargs.get('policy_id', None) - self.state = kwargs.get('state', None) - self.source_protection_container_friendly_name = kwargs.get('source_protection_container_friendly_name', None) - self.source_fabric_friendly_name = kwargs.get('source_fabric_friendly_name', None) - self.target_fabric_friendly_name = kwargs.get('target_fabric_friendly_name', None) - self.policy_friendly_name = kwargs.get('policy_friendly_name', None) - - -class ProtectionContainerProperties(msrest.serialization.Model): - """Protection profile custom data details. - - :param fabric_friendly_name: Fabric friendly name. - :type fabric_friendly_name: str - :param friendly_name: The name. - :type friendly_name: str - :param fabric_type: The fabric type. - :type fabric_type: str - :param protected_item_count: Number of protected PEs. - :type protected_item_count: int - :param pairing_status: The pairing status of this cloud. - :type pairing_status: str - :param role: The role of this cloud. - :type role: str - :param fabric_specific_details: Fabric specific details. - :type fabric_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails - """ - - _attribute_map = { - 'fabric_friendly_name': {'key': 'fabricFriendlyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'fabric_type': {'key': 'fabricType', 'type': 'str'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'int'}, - 'pairing_status': {'key': 'pairingStatus', 'type': 'str'}, - 'role': {'key': 'role', 'type': 'str'}, - 'fabric_specific_details': {'key': 'fabricSpecificDetails', 'type': 'ProtectionContainerFabricSpecificDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(ProtectionContainerProperties, self).__init__(**kwargs) - self.fabric_friendly_name = kwargs.get('fabric_friendly_name', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.fabric_type = kwargs.get('fabric_type', None) - self.protected_item_count = kwargs.get('protected_item_count', None) - self.pairing_status = kwargs.get('pairing_status', None) - self.role = kwargs.get('role', None) - self.fabric_specific_details = kwargs.get('fabric_specific_details', None) - - -class ProviderError(msrest.serialization.Model): - """This class contains the error details per object. - - :param error_code: The Error code. - :type error_code: int - :param error_message: The Error message. - :type error_message: str - :param error_id: The Provider error Id. - :type error_id: str - :param possible_causes: The possible causes for the error. - :type possible_causes: str - :param recommended_action: The recommended action to resolve the error. - :type recommended_action: str - """ - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'error_id': {'key': 'errorId', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProviderError, self).__init__(**kwargs) - self.error_code = kwargs.get('error_code', None) - self.error_message = kwargs.get('error_message', None) - self.error_id = kwargs.get('error_id', None) - self.possible_causes = kwargs.get('possible_causes', None) - self.recommended_action = kwargs.get('recommended_action', None) - - -class PushInstallerDetails(msrest.serialization.Model): - """Push installer details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The push installer Id. - :vartype id: str - :ivar name: The push installer name. - :vartype name: str - :ivar bios_id: The push installer Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The push installer Fqdn. - :vartype fqdn: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the push installer. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the push installer. Possible values include: "None", "Normal", - "Warning", "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - } - - def __init__( - self, - **kwargs - ): - super(PushInstallerDetails, self).__init__(**kwargs) - self.id = None - self.name = None - self.bios_id = None - self.fabric_object_id = None - self.fqdn = None - self.version = None - self.last_heartbeat_utc = None - self.health = None - self.health_errors = None - - -class RcmProxyDetails(msrest.serialization.Model): - """RCM proxy details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The RCM proxy Id. - :vartype id: str - :ivar name: The RCM proxy name. - :vartype name: str - :ivar bios_id: The RCM proxy Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The RCM proxy Fqdn. - :vartype fqdn: str - :ivar client_authentication_type: The client authentication type. - :vartype client_authentication_type: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the RCM proxy. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the RCM proxy. Possible values include: "None", "Normal", - "Warning", "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'client_authentication_type': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'client_authentication_type': {'key': 'clientAuthenticationType', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - } - - def __init__( - self, - **kwargs - ): - super(RcmProxyDetails, self).__init__(**kwargs) - self.id = None - self.name = None - self.bios_id = None - self.fabric_object_id = None - self.fqdn = None - self.client_authentication_type = None - self.version = None - self.last_heartbeat_utc = None - self.health = None - self.health_errors = None - - -class RecoveryPlan(Resource): - """Recovery plan details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom details. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RecoveryPlanProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlan, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class RecoveryPlanProviderSpecificDetails(msrest.serialization.Model): - """Recovery plan provider specific details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanA2ADetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'RecoveryPlanA2ADetails'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanProviderSpecificDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class RecoveryPlanA2ADetails(RecoveryPlanProviderSpecificDetails): - """Recovery plan A2A specific details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param primary_zone: The primary zone. - :type primary_zone: str - :param recovery_zone: The recovery zone. - :type recovery_zone: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_zone': {'key': 'primaryZone', 'type': 'str'}, - 'recovery_zone': {'key': 'recoveryZone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanA2ADetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.primary_zone = kwargs.get('primary_zone', None) - self.recovery_zone = kwargs.get('recovery_zone', None) - - -class RecoveryPlanProviderSpecificFailoverInput(msrest.serialization.Model): - """Recovery plan provider specific failover input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanA2AFailoverInput, RecoveryPlanHyperVReplicaAzureFailoverInput, RecoveryPlanHyperVReplicaAzureFailbackInput, RecoveryPlanInMageFailoverInput, RecoveryPlanInMageAzureV2FailoverInput, RecoveryPlanInMageRcmFailoverInput, RecoveryPlanInMageRcmFailbackFailoverInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'RecoveryPlanA2AFailoverInput', 'HyperVReplicaAzure': 'RecoveryPlanHyperVReplicaAzureFailoverInput', 'HyperVReplicaAzureFailback': 'RecoveryPlanHyperVReplicaAzureFailbackInput', 'InMage': 'RecoveryPlanInMageFailoverInput', 'InMageAzureV2': 'RecoveryPlanInMageAzureV2FailoverInput', 'InMageRcm': 'RecoveryPlanInMageRcmFailoverInput', 'InMageRcmFailback': 'RecoveryPlanInMageRcmFailbackFailoverInput'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanProviderSpecificFailoverInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class RecoveryPlanA2AFailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan A2A failover input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "Latest", "LatestApplicationConsistent", "LatestCrashConsistent", "LatestProcessed". - :type recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.A2ARpRecoveryPointType - :param cloud_service_creation_option: A value indicating whether to use recovery cloud service - for TFO or not. - :type cloud_service_creation_option: str - :param multi_vm_sync_point_option: A value indicating whether multi VM sync enabled VMs should - use multi VM sync points for failover. Possible values include: "UseMultiVmSyncRecoveryPoint", - "UsePerVmRecoveryPoint". - :type multi_vm_sync_point_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmSyncPointOption - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'cloud_service_creation_option': {'key': 'cloudServiceCreationOption', 'type': 'str'}, - 'multi_vm_sync_point_option': {'key': 'multiVmSyncPointOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanA2AFailoverInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.recovery_point_type = kwargs['recovery_point_type'] - self.cloud_service_creation_option = kwargs.get('cloud_service_creation_option', None) - self.multi_vm_sync_point_option = kwargs.get('multi_vm_sync_point_option', None) - - -class RecoveryPlanProviderSpecificInput(msrest.serialization.Model): - """Recovery plan provider specific input base class. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanA2AInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'A2A': 'RecoveryPlanA2AInput'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class RecoveryPlanA2AInput(RecoveryPlanProviderSpecificInput): - """Recovery plan A2A input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param primary_zone: The primary zone. - :type primary_zone: str - :param recovery_zone: The recovery zone. - :type recovery_zone: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_zone': {'key': 'primaryZone', 'type': 'str'}, - 'recovery_zone': {'key': 'recoveryZone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanA2AInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str - self.primary_zone = kwargs.get('primary_zone', None) - self.recovery_zone = kwargs.get('recovery_zone', None) - - -class RecoveryPlanAction(msrest.serialization.Model): - """Recovery plan action details. - - All required parameters must be populated in order to send to Azure. - - :param action_name: Required. The action name. - :type action_name: str - :param failover_types: Required. The list of failover types. - :type failover_types: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation] - :param failover_directions: Required. The list of failover directions. - :type failover_directions: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections] - :param custom_details: Required. The custom details. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionDetails - """ - - _validation = { - 'action_name': {'required': True}, - 'failover_types': {'required': True}, - 'failover_directions': {'required': True}, - 'custom_details': {'required': True}, - } - - _attribute_map = { - 'action_name': {'key': 'actionName', 'type': 'str'}, - 'failover_types': {'key': 'failoverTypes', 'type': '[str]'}, - 'failover_directions': {'key': 'failoverDirections', 'type': '[str]'}, - 'custom_details': {'key': 'customDetails', 'type': 'RecoveryPlanActionDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanAction, self).__init__(**kwargs) - self.action_name = kwargs['action_name'] - self.failover_types = kwargs['failover_types'] - self.failover_directions = kwargs['failover_directions'] - self.custom_details = kwargs['custom_details'] - - -class RecoveryPlanActionDetails(msrest.serialization.Model): - """Recovery plan action custom details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanAutomationRunbookActionDetails, RecoveryPlanManualActionDetails, RecoveryPlanScriptActionDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of action details (see - RecoveryPlanActionDetailsTypes enum for possible values).Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'AutomationRunbookActionDetails': 'RecoveryPlanAutomationRunbookActionDetails', 'ManualActionDetails': 'RecoveryPlanManualActionDetails', 'ScriptActionDetails': 'RecoveryPlanScriptActionDetails'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanActionDetails, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class RecoveryPlanAutomationRunbookActionDetails(RecoveryPlanActionDetails): - """Recovery plan Automation runbook action details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of action details (see - RecoveryPlanActionDetailsTypes enum for possible values).Constant filled by server. - :type instance_type: str - :param runbook_id: The runbook ARM Id. - :type runbook_id: str - :param timeout: The runbook timeout. - :type timeout: str - :param fabric_location: Required. The fabric location. Possible values include: "Primary", - "Recovery". - :type fabric_location: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation - """ - - _validation = { - 'instance_type': {'required': True}, - 'fabric_location': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'runbook_id': {'key': 'runbookId', 'type': 'str'}, - 'timeout': {'key': 'timeout', 'type': 'str'}, - 'fabric_location': {'key': 'fabricLocation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanAutomationRunbookActionDetails, self).__init__(**kwargs) - self.instance_type = 'AutomationRunbookActionDetails' # type: str - self.runbook_id = kwargs.get('runbook_id', None) - self.timeout = kwargs.get('timeout', None) - self.fabric_location = kwargs['fabric_location'] - - -class RecoveryPlanCollection(msrest.serialization.Model): - """Recovery plan collection details. - - :param value: The list of recovery plans. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RecoveryPlan]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RecoveryPlanGroup(msrest.serialization.Model): - """Recovery plan group details. - - All required parameters must be populated in order to send to Azure. - - :param group_type: Required. The group type. Possible values include: "Shutdown", "Boot", - "Failover". - :type group_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroupType - :param replication_protected_items: The list of protected items. - :type replication_protected_items: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem] - :param start_group_actions: The start group actions. - :type start_group_actions: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] - :param end_group_actions: The end group actions. - :type end_group_actions: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] - """ - - _validation = { - 'group_type': {'required': True}, - } - - _attribute_map = { - 'group_type': {'key': 'groupType', 'type': 'str'}, - 'replication_protected_items': {'key': 'replicationProtectedItems', 'type': '[RecoveryPlanProtectedItem]'}, - 'start_group_actions': {'key': 'startGroupActions', 'type': '[RecoveryPlanAction]'}, - 'end_group_actions': {'key': 'endGroupActions', 'type': '[RecoveryPlanAction]'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanGroup, self).__init__(**kwargs) - self.group_type = kwargs['group_type'] - self.replication_protected_items = kwargs.get('replication_protected_items', None) - self.start_group_actions = kwargs.get('start_group_actions', None) - self.end_group_actions = kwargs.get('end_group_actions', None) - - -class RecoveryPlanGroupTaskDetails(GroupTaskDetails): - """This class represents the recovery plan group task. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanShutdownGroupTaskDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param child_tasks: The child tasks. - :type child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :param name: The name. - :type name: str - :param group_id: The group identifier. - :type group_id: str - :param rp_group_type: The group type. - :type rp_group_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'child_tasks': {'key': 'childTasks', 'type': '[ASRTask]'}, - 'name': {'key': 'name', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'rp_group_type': {'key': 'rpGroupType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'RecoveryPlanShutdownGroupTaskDetails': 'RecoveryPlanShutdownGroupTaskDetails'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanGroupTaskDetails, self).__init__(**kwargs) - self.instance_type = 'RecoveryPlanGroupTaskDetails' # type: str - self.name = kwargs.get('name', None) - self.group_id = kwargs.get('group_id', None) - self.rp_group_type = kwargs.get('rp_group_type', None) - - -class RecoveryPlanHyperVReplicaAzureFailbackInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan HVR Azure failback input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param data_sync_option: Required. The data sync option. Possible values include: - "ForDownTime", "ForSynchronization". - :type data_sync_option: str or ~azure.mgmt.recoveryservicessiterecovery.models.DataSyncStatus - :param recovery_vm_creation_option: Required. The ALR option. Possible values include: - "CreateVmIfNotFound", "NoAction". - :type recovery_vm_creation_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AlternateLocationRecoveryOption - """ - - _validation = { - 'instance_type': {'required': True}, - 'data_sync_option': {'required': True}, - 'recovery_vm_creation_option': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'data_sync_option': {'key': 'dataSyncOption', 'type': 'str'}, - 'recovery_vm_creation_option': {'key': 'recoveryVmCreationOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanHyperVReplicaAzureFailbackInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzureFailback' # type: str - self.data_sync_option = kwargs['data_sync_option'] - self.recovery_vm_creation_option = kwargs['recovery_vm_creation_option'] - - -class RecoveryPlanHyperVReplicaAzureFailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan HVR Azure failover input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: The primary KEK certificate PFX. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: The secondary KEK certificate PFX. - :type secondary_kek_certificate_pfx: str - :param recovery_point_type: The recovery point type. Possible values include: "Latest", - "LatestApplicationConsistent", "LatestProcessed". - :type recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureRpRecoveryPointType - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanHyperVReplicaAzureFailoverInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str - self.primary_kek_certificate_pfx = kwargs.get('primary_kek_certificate_pfx', None) - self.secondary_kek_certificate_pfx = kwargs.get('secondary_kek_certificate_pfx', None) - self.recovery_point_type = kwargs.get('recovery_point_type', None) - - -class RecoveryPlanInMageAzureV2FailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan InMageAzureV2 failover input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "Latest", "LatestApplicationConsistent", "LatestCrashConsistent", "LatestProcessed". - :type recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.InMageV2RpRecoveryPointType - :param use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use - multi VM sync points for failover. - :type use_multi_vm_sync_point: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'use_multi_vm_sync_point': {'key': 'useMultiVmSyncPoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanInMageAzureV2FailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str - self.recovery_point_type = kwargs['recovery_point_type'] - self.use_multi_vm_sync_point = kwargs.get('use_multi_vm_sync_point', None) - - -class RecoveryPlanInMageFailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan InMage failover input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "LatestTime", "LatestTag", "Custom". - :type recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RpInMageRecoveryPointType - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanInMageFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str - self.recovery_point_type = kwargs['recovery_point_type'] - - -class RecoveryPlanInMageRcmFailbackFailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan InMageRcmFailback failover input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "ApplicationConsistent", "CrashConsistent". - :type recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType - :param use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use - multi VM sync points for failover. - :type use_multi_vm_sync_point: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'use_multi_vm_sync_point': {'key': 'useMultiVmSyncPoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanInMageRcmFailbackFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str - self.recovery_point_type = kwargs['recovery_point_type'] - self.use_multi_vm_sync_point = kwargs.get('use_multi_vm_sync_point', None) - - -class RecoveryPlanInMageRcmFailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan InMageRcm failover input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "Latest", "LatestApplicationConsistent", "LatestCrashConsistent", "LatestProcessed". - :type recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPointType - :param use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use - multi VM sync points for failover. - :type use_multi_vm_sync_point: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'use_multi_vm_sync_point': {'key': 'useMultiVmSyncPoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanInMageRcmFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str - self.recovery_point_type = kwargs['recovery_point_type'] - self.use_multi_vm_sync_point = kwargs.get('use_multi_vm_sync_point', None) - - -class RecoveryPlanManualActionDetails(RecoveryPlanActionDetails): - """Recovery plan manual action details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of action details (see - RecoveryPlanActionDetailsTypes enum for possible values).Constant filled by server. - :type instance_type: str - :param description: The manual action description. - :type description: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanManualActionDetails, self).__init__(**kwargs) - self.instance_type = 'ManualActionDetails' # type: str - self.description = kwargs.get('description', None) - - -class RecoveryPlanPlannedFailoverInput(msrest.serialization.Model): - """Recovery plan planned failover input. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. The recovery plan planned failover input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RecoveryPlanPlannedFailoverInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanPlannedFailoverInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class RecoveryPlanPlannedFailoverInputProperties(msrest.serialization.Model): - """Recovery plan planned failover input properties. - - All required parameters must be populated in order to send to Azure. - - :param failover_direction: Required. The failover direction. Possible values include: - "PrimaryToRecovery", "RecoveryToPrimary". - :type failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :param provider_specific_details: The provider specific properties. - :type provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] - """ - - _validation = { - 'failover_direction': {'required': True}, - } - - _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': '[RecoveryPlanProviderSpecificFailoverInput]'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanPlannedFailoverInputProperties, self).__init__(**kwargs) - self.failover_direction = kwargs['failover_direction'] - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class RecoveryPlanProperties(msrest.serialization.Model): - """Recovery plan properties. - - :param friendly_name: The friendly name. - :type friendly_name: str - :param primary_fabric_id: The primary fabric Id. - :type primary_fabric_id: str - :param primary_fabric_friendly_name: The primary fabric friendly name. - :type primary_fabric_friendly_name: str - :param recovery_fabric_id: The recovery fabric Id. - :type recovery_fabric_id: str - :param recovery_fabric_friendly_name: The recovery fabric friendly name. - :type recovery_fabric_friendly_name: str - :param failover_deployment_model: The failover deployment model. - :type failover_deployment_model: str - :param replication_providers: The list of replication providers. - :type replication_providers: list[str] - :param allowed_operations: The list of allowed operations. - :type allowed_operations: list[str] - :param last_planned_failover_time: The start time of the last planned failover. - :type last_planned_failover_time: ~datetime.datetime - :param last_unplanned_failover_time: The start time of the last unplanned failover. - :type last_unplanned_failover_time: ~datetime.datetime - :param last_test_failover_time: The start time of the last test failover. - :type last_test_failover_time: ~datetime.datetime - :param current_scenario: The current scenario details. - :type current_scenario: ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :param current_scenario_status: The recovery plan status. - :type current_scenario_status: str - :param current_scenario_status_description: The recovery plan status description. - :type current_scenario_status_description: str - :param groups: The recovery plan groups. - :type groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - :param provider_specific_details: The provider id and provider specific details. - :type provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails] - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'primary_fabric_id': {'key': 'primaryFabricId', 'type': 'str'}, - 'primary_fabric_friendly_name': {'key': 'primaryFabricFriendlyName', 'type': 'str'}, - 'recovery_fabric_id': {'key': 'recoveryFabricId', 'type': 'str'}, - 'recovery_fabric_friendly_name': {'key': 'recoveryFabricFriendlyName', 'type': 'str'}, - 'failover_deployment_model': {'key': 'failoverDeploymentModel', 'type': 'str'}, - 'replication_providers': {'key': 'replicationProviders', 'type': '[str]'}, - 'allowed_operations': {'key': 'allowedOperations', 'type': '[str]'}, - 'last_planned_failover_time': {'key': 'lastPlannedFailoverTime', 'type': 'iso-8601'}, - 'last_unplanned_failover_time': {'key': 'lastUnplannedFailoverTime', 'type': 'iso-8601'}, - 'last_test_failover_time': {'key': 'lastTestFailoverTime', 'type': 'iso-8601'}, - 'current_scenario': {'key': 'currentScenario', 'type': 'CurrentScenarioDetails'}, - 'current_scenario_status': {'key': 'currentScenarioStatus', 'type': 'str'}, - 'current_scenario_status_description': {'key': 'currentScenarioStatusDescription', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[RecoveryPlanGroup]'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': '[RecoveryPlanProviderSpecificDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.primary_fabric_id = kwargs.get('primary_fabric_id', None) - self.primary_fabric_friendly_name = kwargs.get('primary_fabric_friendly_name', None) - self.recovery_fabric_id = kwargs.get('recovery_fabric_id', None) - self.recovery_fabric_friendly_name = kwargs.get('recovery_fabric_friendly_name', None) - self.failover_deployment_model = kwargs.get('failover_deployment_model', None) - self.replication_providers = kwargs.get('replication_providers', None) - self.allowed_operations = kwargs.get('allowed_operations', None) - self.last_planned_failover_time = kwargs.get('last_planned_failover_time', None) - self.last_unplanned_failover_time = kwargs.get('last_unplanned_failover_time', None) - self.last_test_failover_time = kwargs.get('last_test_failover_time', None) - self.current_scenario = kwargs.get('current_scenario', None) - self.current_scenario_status = kwargs.get('current_scenario_status', None) - self.current_scenario_status_description = kwargs.get('current_scenario_status_description', None) - self.groups = kwargs.get('groups', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class RecoveryPlanProtectedItem(msrest.serialization.Model): - """Recovery plan protected item. - - :param id: The ARM Id of the recovery plan protected item. - :type id: str - :param virtual_machine_id: The virtual machine Id. - :type virtual_machine_id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanProtectedItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.virtual_machine_id = kwargs.get('virtual_machine_id', None) - - -class RecoveryPlanScriptActionDetails(RecoveryPlanActionDetails): - """Recovery plan script action details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of action details (see - RecoveryPlanActionDetailsTypes enum for possible values).Constant filled by server. - :type instance_type: str - :param path: Required. The script path. - :type path: str - :param timeout: The script timeout. - :type timeout: str - :param fabric_location: Required. The fabric location. Possible values include: "Primary", - "Recovery". - :type fabric_location: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation - """ - - _validation = { - 'instance_type': {'required': True}, - 'path': {'required': True}, - 'fabric_location': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, - 'timeout': {'key': 'timeout', 'type': 'str'}, - 'fabric_location': {'key': 'fabricLocation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanScriptActionDetails, self).__init__(**kwargs) - self.instance_type = 'ScriptActionDetails' # type: str - self.path = kwargs['path'] - self.timeout = kwargs.get('timeout', None) - self.fabric_location = kwargs['fabric_location'] - - -class RecoveryPlanShutdownGroupTaskDetails(RecoveryPlanGroupTaskDetails): - """This class represents the recovery plan shutdown group task details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param child_tasks: The child tasks. - :type child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :param name: The name. - :type name: str - :param group_id: The group identifier. - :type group_id: str - :param rp_group_type: The group type. - :type rp_group_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'child_tasks': {'key': 'childTasks', 'type': '[ASRTask]'}, - 'name': {'key': 'name', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'rp_group_type': {'key': 'rpGroupType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanShutdownGroupTaskDetails, self).__init__(**kwargs) - self.instance_type = 'RecoveryPlanShutdownGroupTaskDetails' # type: str - - -class RecoveryPlanTestFailoverCleanupInput(msrest.serialization.Model): - """Recovery plan test failover cleanup input. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. The recovery plan test failover cleanup input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RecoveryPlanTestFailoverCleanupInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanTestFailoverCleanupInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class RecoveryPlanTestFailoverCleanupInputProperties(msrest.serialization.Model): - """Recovery plan test failover cleanup input properties. - - :param comments: The test failover cleanup comments. - :type comments: str - """ - - _validation = { - 'comments': {'max_length': 1024, 'min_length': 0}, - } - - _attribute_map = { - 'comments': {'key': 'comments', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanTestFailoverCleanupInputProperties, self).__init__(**kwargs) - self.comments = kwargs.get('comments', None) - - -class RecoveryPlanTestFailoverInput(msrest.serialization.Model): - """Recovery plan test failover input. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. The recovery plan test failover input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RecoveryPlanTestFailoverInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanTestFailoverInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class RecoveryPlanTestFailoverInputProperties(msrest.serialization.Model): - """Recovery plan test failover input properties. - - All required parameters must be populated in order to send to Azure. - - :param failover_direction: Required. The failover direction. Possible values include: - "PrimaryToRecovery", "RecoveryToPrimary". - :type failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :param network_type: Required. The network type to be used for test failover. - :type network_type: str - :param network_id: The Id of the network to be used for test failover. - :type network_id: str - :param provider_specific_details: The provider specific properties. - :type provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] - """ - - _validation = { - 'failover_direction': {'required': True}, - 'network_type': {'required': True}, - } - - _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'network_type': {'key': 'networkType', 'type': 'str'}, - 'network_id': {'key': 'networkId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': '[RecoveryPlanProviderSpecificFailoverInput]'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanTestFailoverInputProperties, self).__init__(**kwargs) - self.failover_direction = kwargs['failover_direction'] - self.network_type = kwargs['network_type'] - self.network_id = kwargs.get('network_id', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class RecoveryPlanUnplannedFailoverInput(msrest.serialization.Model): - """Recovery plan unplanned failover input. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. The recovery plan unplanned failover input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RecoveryPlanUnplannedFailoverInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanUnplannedFailoverInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class RecoveryPlanUnplannedFailoverInputProperties(msrest.serialization.Model): - """Recovery plan unplanned failover input properties. - - All required parameters must be populated in order to send to Azure. - - :param failover_direction: Required. The failover direction. Possible values include: - "PrimaryToRecovery", "RecoveryToPrimary". - :type failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :param source_site_operations: Required. A value indicating whether source site operations are - required. Possible values include: "Required", "NotRequired". - :type source_site_operations: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SourceSiteOperations - :param provider_specific_details: The provider specific properties. - :type provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] - """ - - _validation = { - 'failover_direction': {'required': True}, - 'source_site_operations': {'required': True}, - } - - _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'source_site_operations': {'key': 'sourceSiteOperations', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': '[RecoveryPlanProviderSpecificFailoverInput]'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanUnplannedFailoverInputProperties, self).__init__(**kwargs) - self.failover_direction = kwargs['failover_direction'] - self.source_site_operations = kwargs['source_site_operations'] - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class RecoveryPoint(Resource): - """Recovery point. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The recovery point properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RecoveryPointProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPoint, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class RecoveryPointCollection(msrest.serialization.Model): - """Collection of recovery point details. - - :param value: The recovery point details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RecoveryPoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPointCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RecoveryPointProperties(msrest.serialization.Model): - """Recovery point properties. - - :param recovery_point_time: The recovery point time. - :type recovery_point_time: ~datetime.datetime - :param recovery_point_type: The recovery point type: ApplicationConsistent, CrashConsistent. - :type recovery_point_type: str - :param provider_specific_details: The provider specific details for the recovery point. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails - """ - - _attribute_map = { - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ProviderSpecificRecoveryPointDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPointProperties, self).__init__(**kwargs) - self.recovery_point_time = kwargs.get('recovery_point_time', None) - self.recovery_point_type = kwargs.get('recovery_point_type', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class RecoveryServicesProvider(Resource): - """Provider details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Provider properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RecoveryServicesProviderProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryServicesProvider, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class RecoveryServicesProviderCollection(msrest.serialization.Model): - """Collection of providers. - - :param value: The Servers details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RecoveryServicesProvider]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryServicesProviderCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RecoveryServicesProviderProperties(msrest.serialization.Model): - """Recovery services provider properties. - - :param fabric_type: Type of the site. - :type fabric_type: str - :param friendly_name: Friendly name of the DRA. - :type friendly_name: str - :param provider_version: The provider version. - :type provider_version: str - :param server_version: The fabric provider. - :type server_version: str - :param provider_version_state: DRA version status. - :type provider_version_state: str - :param provider_version_expiry_date: Expiry date of the version. - :type provider_version_expiry_date: ~datetime.datetime - :param fabric_friendly_name: The fabric friendly name. - :type fabric_friendly_name: str - :param last_heart_beat: Time when last heartbeat was sent by the DRA. - :type last_heart_beat: ~datetime.datetime - :param connection_status: A value indicating whether DRA is responsive. - :type connection_status: str - :param protected_item_count: Number of protected VMs currently managed by the DRA. - :type protected_item_count: int - :param allowed_scenarios: The scenarios allowed on this provider. - :type allowed_scenarios: list[str] - :param health_error_details: The recovery services provider health error details. - :type health_error_details: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param dra_identifier: The DRA Id. - :type dra_identifier: str - :param machine_id: The machine Id. - :type machine_id: str - :param machine_name: The machine name. - :type machine_name: str - :param bios_id: The Bios Id. - :type bios_id: str - :param authentication_identity_details: The authentication identity details. - :type authentication_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :param resource_access_identity_details: The resource access identity details. - :type resource_access_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :param data_plane_authentication_identity_details: The data plane authentication identity - details. - :type data_plane_authentication_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :param provider_version_details: The provider version details. - :type provider_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - - _attribute_map = { - 'fabric_type': {'key': 'fabricType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'provider_version': {'key': 'providerVersion', 'type': 'str'}, - 'server_version': {'key': 'serverVersion', 'type': 'str'}, - 'provider_version_state': {'key': 'providerVersionState', 'type': 'str'}, - 'provider_version_expiry_date': {'key': 'providerVersionExpiryDate', 'type': 'iso-8601'}, - 'fabric_friendly_name': {'key': 'fabricFriendlyName', 'type': 'str'}, - 'last_heart_beat': {'key': 'lastHeartBeat', 'type': 'iso-8601'}, - 'connection_status': {'key': 'connectionStatus', 'type': 'str'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'int'}, - 'allowed_scenarios': {'key': 'allowedScenarios', 'type': '[str]'}, - 'health_error_details': {'key': 'healthErrorDetails', 'type': '[HealthError]'}, - 'dra_identifier': {'key': 'draIdentifier', 'type': 'str'}, - 'machine_id': {'key': 'machineId', 'type': 'str'}, - 'machine_name': {'key': 'machineName', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'authentication_identity_details': {'key': 'authenticationIdentityDetails', 'type': 'IdentityProviderDetails'}, - 'resource_access_identity_details': {'key': 'resourceAccessIdentityDetails', 'type': 'IdentityProviderDetails'}, - 'data_plane_authentication_identity_details': {'key': 'dataPlaneAuthenticationIdentityDetails', 'type': 'IdentityProviderDetails'}, - 'provider_version_details': {'key': 'providerVersionDetails', 'type': 'VersionDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoveryServicesProviderProperties, self).__init__(**kwargs) - self.fabric_type = kwargs.get('fabric_type', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.provider_version = kwargs.get('provider_version', None) - self.server_version = kwargs.get('server_version', None) - self.provider_version_state = kwargs.get('provider_version_state', None) - self.provider_version_expiry_date = kwargs.get('provider_version_expiry_date', None) - self.fabric_friendly_name = kwargs.get('fabric_friendly_name', None) - self.last_heart_beat = kwargs.get('last_heart_beat', None) - self.connection_status = kwargs.get('connection_status', None) - self.protected_item_count = kwargs.get('protected_item_count', None) - self.allowed_scenarios = kwargs.get('allowed_scenarios', None) - self.health_error_details = kwargs.get('health_error_details', None) - self.dra_identifier = kwargs.get('dra_identifier', None) - self.machine_id = kwargs.get('machine_id', None) - self.machine_name = kwargs.get('machine_name', None) - self.bios_id = kwargs.get('bios_id', None) - self.authentication_identity_details = kwargs.get('authentication_identity_details', None) - self.resource_access_identity_details = kwargs.get('resource_access_identity_details', None) - self.data_plane_authentication_identity_details = kwargs.get('data_plane_authentication_identity_details', None) - self.provider_version_details = kwargs.get('provider_version_details', None) - - -class RemoveDisksInput(msrest.serialization.Model): - """Input for remove disk(s) operation. - - :param properties: Remove disk input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RemoveDisksInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RemoveDisksInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class RemoveDisksInputProperties(msrest.serialization.Model): - """Remove Disk input properties. - - :param provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure - provider, it will be AzureEnableProtectionInput object. For San provider, it will be - SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput - """ - - _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'RemoveDisksProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(RemoveDisksInputProperties, self).__init__(**kwargs) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class RemoveProtectionContainerMappingInput(msrest.serialization.Model): - """Container unpairing input. - - :param properties: Configure protection input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RemoveProtectionContainerMappingInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RemoveProtectionContainerMappingInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class RemoveProtectionContainerMappingInputProperties(msrest.serialization.Model): - """Unpairing input properties. - - :param provider_specific_input: Provider specific input for unpairing. - :type provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput - """ - - _attribute_map = { - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': 'ReplicationProviderContainerUnmappingInput'}, - } - - def __init__( - self, - **kwargs - ): - super(RemoveProtectionContainerMappingInputProperties, self).__init__(**kwargs) - self.provider_specific_input = kwargs.get('provider_specific_input', None) - - -class RenewCertificateInput(msrest.serialization.Model): - """Certificate renewal input. - - :param properties: Renew certificate input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RenewCertificateInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(RenewCertificateInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class RenewCertificateInputProperties(msrest.serialization.Model): - """Renew Certificate input properties. - - :param renew_certificate_type: Renew certificate type. - :type renew_certificate_type: str - """ - - _attribute_map = { - 'renew_certificate_type': {'key': 'renewCertificateType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RenewCertificateInputProperties, self).__init__(**kwargs) - self.renew_certificate_type = kwargs.get('renew_certificate_type', None) - - -class ReplicationAgentDetails(msrest.serialization.Model): - """Replication agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The replication agent Id. - :vartype id: str - :ivar name: The replication agent name. - :vartype name: str - :ivar bios_id: The replication agent Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The replication agent Fqdn. - :vartype fqdn: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the replication agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the replication agent. Possible values include: "None", "Normal", - "Warning", "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationAgentDetails, self).__init__(**kwargs) - self.id = None - self.name = None - self.bios_id = None - self.fabric_object_id = None - self.fqdn = None - self.version = None - self.last_heartbeat_utc = None - self.health = None - self.health_errors = None - - -class ReplicationEligibilityResults(msrest.serialization.Model): - """Replication eligibility results response model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Gets the name of this object. - :vartype name: str - :ivar type: Gets the object type. - :vartype type: str - :ivar id: Gets Unique ARM identifier for this object. - :vartype id: str - :ivar properties: Gets properties model for replication eligibility results API. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsProperties - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'id': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ReplicationEligibilityResultsProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationEligibilityResults, self).__init__(**kwargs) - self.name = None - self.type = None - self.id = None - self.properties = None - - -class ReplicationEligibilityResultsCollection(msrest.serialization.Model): - """Replication eligibility results collection response model. - - :param value: The replication eligibility results details. - :type value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ReplicationEligibilityResults]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationEligibilityResultsCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ReplicationEligibilityResultsErrorInfo(msrest.serialization.Model): - """Error model that can be exposed to the user. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param possible_causes: The possible causes. - :type possible_causes: str - :param recommended_action: The recommended action. - :type recommended_action: str - :ivar status: The error status. - :vartype status: str - """ - - _validation = { - 'status': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationEligibilityResultsErrorInfo, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.possible_causes = kwargs.get('possible_causes', None) - self.recommended_action = kwargs.get('recommended_action', None) - self.status = None - - -class ReplicationEligibilityResultsProperties(msrest.serialization.Model): - """Properties model for replication eligibility results API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar client_request_id: The client request Id. - :vartype client_request_id: str - :param errors: The error details. - :type errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsErrorInfo] - """ - - _validation = { - 'client_request_id': {'readonly': True}, - } - - _attribute_map = { - 'client_request_id': {'key': 'clientRequestId', 'type': 'str'}, - 'errors': {'key': 'errors', 'type': '[ReplicationEligibilityResultsErrorInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationEligibilityResultsProperties, self).__init__(**kwargs) - self.client_request_id = None - self.errors = kwargs.get('errors', None) - - -class ReplicationGroupDetails(ConfigurationSettings): - """Replication group details. This will be used in case of San. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationGroupDetails, self).__init__(**kwargs) - self.instance_type = 'ReplicationGroupDetails' # type: str - - -class ReplicationProtectedItem(Resource): - """Replication protected item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ReplicationProtectedItemProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProtectedItem, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ReplicationProtectedItemCollection(msrest.serialization.Model): - """Replication protected item collection. - - :param value: The Replication protected item details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ReplicationProtectedItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProtectedItemCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReplicationProtectedItemProperties(msrest.serialization.Model): - """Replication protected item custom data details. - - :param friendly_name: The name. - :type friendly_name: str - :param protected_item_type: The type of protected item type. - :type protected_item_type: str - :param protectable_item_id: The protected item ARM Id. - :type protectable_item_id: str - :param recovery_services_provider_id: The recovery provider ARM Id. - :type recovery_services_provider_id: str - :param primary_fabric_friendly_name: The friendly name of the primary fabric. - :type primary_fabric_friendly_name: str - :param primary_fabric_provider: The fabric provider of the primary fabric. - :type primary_fabric_provider: str - :param recovery_fabric_friendly_name: The friendly name of recovery fabric. - :type recovery_fabric_friendly_name: str - :param recovery_fabric_id: The Arm Id of recovery fabric. - :type recovery_fabric_id: str - :param primary_protection_container_friendly_name: The name of primary protection container - friendly name. - :type primary_protection_container_friendly_name: str - :param recovery_protection_container_friendly_name: The name of recovery container friendly - name. - :type recovery_protection_container_friendly_name: str - :param protection_state: The protection status. - :type protection_state: str - :param protection_state_description: The protection state description. - :type protection_state_description: str - :param active_location: The Current active location of the PE. - :type active_location: str - :param test_failover_state: The Test failover state. - :type test_failover_state: str - :param test_failover_state_description: The Test failover state description. - :type test_failover_state_description: str - :param allowed_operations: The allowed operations on the Replication protected item. - :type allowed_operations: list[str] - :param replication_health: The consolidated protection health for the VM taking any issues with - SRS as well as all the replication units associated with the VM's replication group into - account. This is a string representation of the ProtectionHealth enumeration. - :type replication_health: str - :param failover_health: The consolidated failover health for the VM. - :type failover_health: str - :param health_errors: List of health errors. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param policy_id: The ID of Policy governing this PE. - :type policy_id: str - :param policy_friendly_name: The name of Policy governing this PE. - :type policy_friendly_name: str - :param last_successful_failover_time: The Last successful failover time. - :type last_successful_failover_time: ~datetime.datetime - :param last_successful_test_failover_time: The Last successful test failover time. - :type last_successful_test_failover_time: ~datetime.datetime - :param current_scenario: The current scenario. - :type current_scenario: ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :param failover_recovery_point_id: The recovery point ARM Id to which the Vm was failed over. - :type failover_recovery_point_id: str - :param provider_specific_details: The Replication provider custom settings. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificSettings - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str - :param event_correlation_id: The correlation Id for events associated with this protected item. - :type event_correlation_id: str - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'protectable_item_id': {'key': 'protectableItemId', 'type': 'str'}, - 'recovery_services_provider_id': {'key': 'recoveryServicesProviderId', 'type': 'str'}, - 'primary_fabric_friendly_name': {'key': 'primaryFabricFriendlyName', 'type': 'str'}, - 'primary_fabric_provider': {'key': 'primaryFabricProvider', 'type': 'str'}, - 'recovery_fabric_friendly_name': {'key': 'recoveryFabricFriendlyName', 'type': 'str'}, - 'recovery_fabric_id': {'key': 'recoveryFabricId', 'type': 'str'}, - 'primary_protection_container_friendly_name': {'key': 'primaryProtectionContainerFriendlyName', 'type': 'str'}, - 'recovery_protection_container_friendly_name': {'key': 'recoveryProtectionContainerFriendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'protection_state_description': {'key': 'protectionStateDescription', 'type': 'str'}, - 'active_location': {'key': 'activeLocation', 'type': 'str'}, - 'test_failover_state': {'key': 'testFailoverState', 'type': 'str'}, - 'test_failover_state_description': {'key': 'testFailoverStateDescription', 'type': 'str'}, - 'allowed_operations': {'key': 'allowedOperations', 'type': '[str]'}, - 'replication_health': {'key': 'replicationHealth', 'type': 'str'}, - 'failover_health': {'key': 'failoverHealth', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'policy_friendly_name': {'key': 'policyFriendlyName', 'type': 'str'}, - 'last_successful_failover_time': {'key': 'lastSuccessfulFailoverTime', 'type': 'iso-8601'}, - 'last_successful_test_failover_time': {'key': 'lastSuccessfulTestFailoverTime', 'type': 'iso-8601'}, - 'current_scenario': {'key': 'currentScenario', 'type': 'CurrentScenarioDetails'}, - 'failover_recovery_point_id': {'key': 'failoverRecoveryPointId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ReplicationProviderSpecificSettings'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, - 'event_correlation_id': {'key': 'eventCorrelationId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProtectedItemProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.protected_item_type = kwargs.get('protected_item_type', None) - self.protectable_item_id = kwargs.get('protectable_item_id', None) - self.recovery_services_provider_id = kwargs.get('recovery_services_provider_id', None) - self.primary_fabric_friendly_name = kwargs.get('primary_fabric_friendly_name', None) - self.primary_fabric_provider = kwargs.get('primary_fabric_provider', None) - self.recovery_fabric_friendly_name = kwargs.get('recovery_fabric_friendly_name', None) - self.recovery_fabric_id = kwargs.get('recovery_fabric_id', None) - self.primary_protection_container_friendly_name = kwargs.get('primary_protection_container_friendly_name', None) - self.recovery_protection_container_friendly_name = kwargs.get('recovery_protection_container_friendly_name', None) - self.protection_state = kwargs.get('protection_state', None) - self.protection_state_description = kwargs.get('protection_state_description', None) - self.active_location = kwargs.get('active_location', None) - self.test_failover_state = kwargs.get('test_failover_state', None) - self.test_failover_state_description = kwargs.get('test_failover_state_description', None) - self.allowed_operations = kwargs.get('allowed_operations', None) - self.replication_health = kwargs.get('replication_health', None) - self.failover_health = kwargs.get('failover_health', None) - self.health_errors = kwargs.get('health_errors', None) - self.policy_id = kwargs.get('policy_id', None) - self.policy_friendly_name = kwargs.get('policy_friendly_name', None) - self.last_successful_failover_time = kwargs.get('last_successful_failover_time', None) - self.last_successful_test_failover_time = kwargs.get('last_successful_test_failover_time', None) - self.current_scenario = kwargs.get('current_scenario', None) - self.failover_recovery_point_id = kwargs.get('failover_recovery_point_id', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - self.recovery_container_id = kwargs.get('recovery_container_id', None) - self.event_correlation_id = kwargs.get('event_correlation_id', None) - - -class ReplicationProtectionIntent(Resource): - """Replication protection intent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ReplicationProtectionIntentProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProtectionIntent, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ReplicationProtectionIntentCollection(msrest.serialization.Model): - """Replication protection intent objects collection. - - :param value: The Replication protection intent details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ReplicationProtectionIntent]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProtectionIntentCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReplicationProtectionIntentProperties(msrest.serialization.Model): - """Replication protection intent custom data details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param friendly_name: The name. - :type friendly_name: str - :ivar job_id: The job Id. - :vartype job_id: str - :ivar job_state: The job state. - :vartype job_state: str - :ivar is_active: A value indicating whether the intent object is active. - :vartype is_active: bool - :ivar creation_time_utc: The creation time in UTC. - :vartype creation_time_utc: str - :param provider_specific_details: The Replication provider custom settings. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings - """ - - _validation = { - 'job_id': {'readonly': True}, - 'job_state': {'readonly': True}, - 'is_active': {'readonly': True}, - 'creation_time_utc': {'readonly': True}, - } - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'job_state': {'key': 'jobState', 'type': 'str'}, - 'is_active': {'key': 'isActive', 'type': 'bool'}, - 'creation_time_utc': {'key': 'creationTimeUTC', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ReplicationProtectionIntentProviderSpecificSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProtectionIntentProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.job_id = None - self.job_state = None - self.is_active = None - self.creation_time_utc = None - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class ReplicationProviderContainerUnmappingInput(msrest.serialization.Model): - """Provider specific input for unpairing operations. - - :param instance_type: The class type. - :type instance_type: str - """ - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProviderContainerUnmappingInput, self).__init__(**kwargs) - self.instance_type = kwargs.get('instance_type', None) - - -class ReprotectAgentDetails(msrest.serialization.Model): - """Reprotect agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The reprotect agent Id. - :vartype id: str - :ivar name: The reprotect agent name. - :vartype name: str - :ivar bios_id: The reprotect agent Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The reprotect agent Fqdn. - :vartype fqdn: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the reprotect agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the reprotect agent. Possible values include: "None", "Normal", - "Warning", "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar protected_item_count: The protected item count. - :vartype protected_item_count: int - :ivar accessible_datastores: The list of accessible datastores fetched from discovery. - :vartype accessible_datastores: list[str] - :ivar vcenter_id: The Vcenter Id. - :vartype vcenter_id: str - :ivar last_discovery_in_utc: The last time when SDS information discovered in SRS. - :vartype last_discovery_in_utc: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - 'protected_item_count': {'readonly': True}, - 'accessible_datastores': {'readonly': True}, - 'vcenter_id': {'readonly': True}, - 'last_discovery_in_utc': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'int'}, - 'accessible_datastores': {'key': 'accessibleDatastores', 'type': '[str]'}, - 'vcenter_id': {'key': 'vcenterId', 'type': 'str'}, - 'last_discovery_in_utc': {'key': 'lastDiscoveryInUtc', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ReprotectAgentDetails, self).__init__(**kwargs) - self.id = None - self.name = None - self.bios_id = None - self.fabric_object_id = None - self.fqdn = None - self.version = None - self.last_heartbeat_utc = None - self.health = None - self.health_errors = None - self.protected_item_count = None - self.accessible_datastores = None - self.vcenter_id = None - self.last_discovery_in_utc = None - - -class ResolveHealthError(msrest.serialization.Model): - """Resolve health errors input properties. - - :param health_error_id: Health error id. - :type health_error_id: str - """ - - _attribute_map = { - 'health_error_id': {'key': 'healthErrorId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResolveHealthError, self).__init__(**kwargs) - self.health_error_id = kwargs.get('health_error_id', None) - - -class ResolveHealthInput(msrest.serialization.Model): - """Resolve health input. - - :param properties: Disable resolve health input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ResolveHealthInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ResolveHealthInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ResolveHealthInputProperties(msrest.serialization.Model): - """Resolve health input properties. - - :param health_errors: Health errors. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthError] - """ - - _attribute_map = { - 'health_errors': {'key': 'healthErrors', 'type': '[ResolveHealthError]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResolveHealthInputProperties, self).__init__(**kwargs) - self.health_errors = kwargs.get('health_errors', None) - - -class ResourceHealthSummary(msrest.serialization.Model): - """Base class to define the health summary of the resources contained under an Arm resource. - - :param resource_count: The count of total resources under the container. - :type resource_count: int - :param issues: The list of summary of health errors across the resources under the container. - :type issues: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorSummary] - :param categorized_resource_counts: The categorized resource counts. - :type categorized_resource_counts: dict[str, int] - """ - - _attribute_map = { - 'resource_count': {'key': 'resourceCount', 'type': 'int'}, - 'issues': {'key': 'issues', 'type': '[HealthErrorSummary]'}, - 'categorized_resource_counts': {'key': 'categorizedResourceCounts', 'type': '{int}'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceHealthSummary, self).__init__(**kwargs) - self.resource_count = kwargs.get('resource_count', None) - self.issues = kwargs.get('issues', None) - self.categorized_resource_counts = kwargs.get('categorized_resource_counts', None) - - -class ResumeJobParams(msrest.serialization.Model): - """Resume job params. - - :param properties: Resume job properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParamsProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ResumeJobParamsProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ResumeJobParams, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ResumeJobParamsProperties(msrest.serialization.Model): - """Resume job properties. - - :param comments: Resume job comments. - :type comments: str - """ - - _attribute_map = { - 'comments': {'key': 'comments', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResumeJobParamsProperties, self).__init__(**kwargs) - self.comments = kwargs.get('comments', None) - - -class ResyncInput(msrest.serialization.Model): - """Resync input. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Resync input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ResyncInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ResyncInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class ResyncInputProperties(msrest.serialization.Model): - """Resync input properties. - - All required parameters must be populated in order to send to Azure. - - :param provider_specific_details: Required. The provider specific details. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ResyncProviderSpecificInput - """ - - _validation = { - 'provider_specific_details': {'required': True}, - } - - _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ResyncProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(ResyncInputProperties, self).__init__(**kwargs) - self.provider_specific_details = kwargs['provider_specific_details'] - - -class ResyncProviderSpecificInput(msrest.serialization.Model): - """Resync provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtResyncInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtResyncInput'} - } - - def __init__( - self, - **kwargs - ): - super(ResyncProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class RetentionVolume(msrest.serialization.Model): - """The retention details of the MT. - - :param volume_name: The volume name. - :type volume_name: str - :param capacity_in_bytes: The volume capacity. - :type capacity_in_bytes: long - :param free_space_in_bytes: The free space available in this volume. - :type free_space_in_bytes: long - :param threshold_percentage: The threshold percentage. - :type threshold_percentage: int - """ - - _attribute_map = { - 'volume_name': {'key': 'volumeName', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'free_space_in_bytes': {'key': 'freeSpaceInBytes', 'type': 'long'}, - 'threshold_percentage': {'key': 'thresholdPercentage', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(RetentionVolume, self).__init__(**kwargs) - self.volume_name = kwargs.get('volume_name', None) - self.capacity_in_bytes = kwargs.get('capacity_in_bytes', None) - self.free_space_in_bytes = kwargs.get('free_space_in_bytes', None) - self.threshold_percentage = kwargs.get('threshold_percentage', None) - - -class ReverseReplicationInput(msrest.serialization.Model): - """Reverse replication input. - - :param properties: Reverse replication properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ReverseReplicationInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseReplicationInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ReverseReplicationInputProperties(msrest.serialization.Model): - """Reverse replication input properties. - - :param failover_direction: Failover direction. - :type failover_direction: str - :param provider_specific_details: Provider specific reverse replication input. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput - """ - - _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ReverseReplicationProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseReplicationInputProperties, self).__init__(**kwargs) - self.failover_direction = kwargs.get('failover_direction', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class RoleAssignment(msrest.serialization.Model): - """Azure role assignment details. - - :param id: The ARM Id of the role assignment. - :type id: str - :param name: The name of the role assignment. - :type name: str - :param scope: Role assignment scope. - :type scope: str - :param principal_id: Principal Id. - :type principal_id: str - :param role_definition_id: Role definition id. - :type role_definition_id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleAssignment, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.scope = kwargs.get('scope', None) - self.principal_id = kwargs.get('principal_id', None) - self.role_definition_id = kwargs.get('role_definition_id', None) - - -class RunAsAccount(msrest.serialization.Model): - """CS Accounts Details. - - :param account_id: The CS RunAs account Id. - :type account_id: str - :param account_name: The CS RunAs account name. - :type account_name: str - """ - - _attribute_map = { - 'account_id': {'key': 'accountId', 'type': 'str'}, - 'account_name': {'key': 'accountName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunAsAccount, self).__init__(**kwargs) - self.account_id = kwargs.get('account_id', None) - self.account_name = kwargs.get('account_name', None) - - -class ScriptActionTaskDetails(TaskTypeDetails): - """This class represents the script action task details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param name: The name. - :type name: str - :param path: The path. - :type path: str - :param output: The output. - :type output: str - :param is_primary_side_script: A value indicating whether it is a primary side script or not. - :type is_primary_side_script: bool - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, - 'output': {'key': 'output', 'type': 'str'}, - 'is_primary_side_script': {'key': 'isPrimarySideScript', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptActionTaskDetails, self).__init__(**kwargs) - self.instance_type = 'ScriptActionTaskDetails' # type: str - self.name = kwargs.get('name', None) - self.path = kwargs.get('path', None) - self.output = kwargs.get('output', None) - self.is_primary_side_script = kwargs.get('is_primary_side_script', None) - - -class ServiceError(msrest.serialization.Model): - """ASR error model. - - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str - :param possible_causes: Possible causes of error. - :type possible_causes: str - :param recommended_action: Recommended action to resolve error. - :type recommended_action: str - :param activity_id: Activity Id. - :type activity_id: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.possible_causes = kwargs.get('possible_causes', None) - self.recommended_action = kwargs.get('recommended_action', None) - self.activity_id = kwargs.get('activity_id', None) - - -class StorageClassification(Resource): - """Storage object definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Properties of the storage object. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'StorageClassificationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageClassification, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class StorageClassificationCollection(msrest.serialization.Model): - """Collection of storage details. - - :param value: The storage details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageClassification]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageClassificationCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class StorageClassificationMapping(Resource): - """Storage mapping object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Properties of the storage mapping object. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'StorageClassificationMappingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageClassificationMapping, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class StorageClassificationMappingCollection(msrest.serialization.Model): - """Collection of storage mapping details. - - :param value: The storage details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageClassificationMapping]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageClassificationMappingCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class StorageClassificationMappingInput(msrest.serialization.Model): - """Storage mapping input. - - :param properties: Storage mapping input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.StorageMappingInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'StorageMappingInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageClassificationMappingInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class StorageClassificationMappingProperties(msrest.serialization.Model): - """Storage mapping properties. - - :param target_storage_classification_id: Target storage object Id. - :type target_storage_classification_id: str - """ - - _attribute_map = { - 'target_storage_classification_id': {'key': 'targetStorageClassificationId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageClassificationMappingProperties, self).__init__(**kwargs) - self.target_storage_classification_id = kwargs.get('target_storage_classification_id', None) - - -class StorageClassificationProperties(msrest.serialization.Model): - """Storage object properties. - - :param friendly_name: Friendly name of the Storage classification. - :type friendly_name: str - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageClassificationProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - - -class StorageMappingInputProperties(msrest.serialization.Model): - """Storage mapping input properties. - - :param target_storage_classification_id: The ID of the storage object. - :type target_storage_classification_id: str - """ - - _attribute_map = { - 'target_storage_classification_id': {'key': 'targetStorageClassificationId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageMappingInputProperties, self).__init__(**kwargs) - self.target_storage_classification_id = kwargs.get('target_storage_classification_id', None) - - -class Subnet(msrest.serialization.Model): - """Subnets of the network. - - :param name: The subnet name. - :type name: str - :param friendly_name: The subnet friendly name. - :type friendly_name: str - :param address_list: The list of addresses for the subnet. - :type address_list: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'address_list': {'key': 'addressList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Subnet, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.address_list = kwargs.get('address_list', None) - - -class SupportedOperatingSystems(Resource): - """Supported operating systems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The supported operating systems properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'SupportedOSProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedOperatingSystems, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class SupportedOSDetails(msrest.serialization.Model): - """Supported operating system details. - - :param os_name: The name. - :type os_name: str - :param os_type: The type. - :type os_type: str - :param os_versions: The list of version for operating system. - :type os_versions: list[~azure.mgmt.recoveryservicessiterecovery.models.OSVersionWrapper] - """ - - _attribute_map = { - 'os_name': {'key': 'osName', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_versions': {'key': 'osVersions', 'type': '[OSVersionWrapper]'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedOSDetails, self).__init__(**kwargs) - self.os_name = kwargs.get('os_name', None) - self.os_type = kwargs.get('os_type', None) - self.os_versions = kwargs.get('os_versions', None) - - -class SupportedOSProperties(msrest.serialization.Model): - """Supported operating systems properties. - - :param supported_os_list: The supported operating systems property list. - :type supported_os_list: - list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperty] - """ - - _attribute_map = { - 'supported_os_list': {'key': 'supportedOsList', 'type': '[SupportedOSProperty]'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedOSProperties, self).__init__(**kwargs) - self.supported_os_list = kwargs.get('supported_os_list', None) - - -class SupportedOSProperty(msrest.serialization.Model): - """Supported operating systems property. - - :param instance_type: The replication provider type. - :type instance_type: str - :param supported_os: The list of supported operating systems. - :type supported_os: list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSDetails] - """ - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'supported_os': {'key': 'supportedOs', 'type': '[SupportedOSDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedOSProperty, self).__init__(**kwargs) - self.instance_type = kwargs.get('instance_type', None) - self.supported_os = kwargs.get('supported_os', None) - - -class SwitchProtectionInput(msrest.serialization.Model): - """Switch protection input. - - :param properties: Switch protection properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'SwitchProtectionInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SwitchProtectionInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class SwitchProtectionInputProperties(msrest.serialization.Model): - """Switch protection input properties. - - :param replication_protected_item_name: The unique replication protected item name. - :type replication_protected_item_name: str - :param provider_specific_details: Provider specific switch protection input. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput - """ - - _attribute_map = { - 'replication_protected_item_name': {'key': 'replicationProtectedItemName', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'SwitchProtectionProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(SwitchProtectionInputProperties, self).__init__(**kwargs) - self.replication_protected_item_name = kwargs.get('replication_protected_item_name', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class SwitchProtectionJobDetails(JobDetails): - """This class represents details for switch protection job. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - :param new_replication_protected_item_id: ARM Id of the new replication protected item. - :type new_replication_protected_item_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - 'new_replication_protected_item_id': {'key': 'newReplicationProtectedItemId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SwitchProtectionJobDetails, self).__init__(**kwargs) - self.instance_type = 'SwitchProtectionJobDetails' # type: str - self.new_replication_protected_item_id = kwargs.get('new_replication_protected_item_id', None) - - -class TargetComputeSize(msrest.serialization.Model): - """Represents applicable recovery vm sizes. - - :param id: The Id. - :type id: str - :param name: The name. - :type name: str - :param type: The Type of the object. - :type type: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeProperties - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'TargetComputeSizeProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetComputeSize, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.properties = kwargs.get('properties', None) - - -class TargetComputeSizeCollection(msrest.serialization.Model): - """Target compute size collection. - - :param value: The list of target compute sizes. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TargetComputeSize]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetComputeSizeCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class TargetComputeSizeProperties(msrest.serialization.Model): - """Represents applicable recovery vm sizes properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Target compute size name. - :type name: str - :param friendly_name: Target compute size display name. - :type friendly_name: str - :param cpu_cores_count: The maximum cpu cores count supported by target compute size. - :type cpu_cores_count: int - :ivar v_cpus_available: The Available vCPUs supported by target compute size. - :vartype v_cpus_available: int - :param memory_in_gb: The maximum memory in GB supported by target compute size. - :type memory_in_gb: float - :param max_data_disk_count: The maximum data disks count supported by target compute size. - :type max_data_disk_count: int - :param max_nics_count: The maximum Nics count supported by target compute size. - :type max_nics_count: int - :param errors: The reasons why the target compute size is not applicable for the protected - item. - :type errors: list[~azure.mgmt.recoveryservicessiterecovery.models.ComputeSizeErrorDetails] - :param high_iops_supported: The value indicating whether the target compute size supports high - Iops. - :type high_iops_supported: str - :param hyper_v_generations: The supported HyperV Generations. - :type hyper_v_generations: list[str] - """ - - _validation = { - 'v_cpus_available': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'cpu_cores_count': {'key': 'cpuCoresCount', 'type': 'int'}, - 'v_cpus_available': {'key': 'vCPUsAvailable', 'type': 'int'}, - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'float'}, - 'max_data_disk_count': {'key': 'maxDataDiskCount', 'type': 'int'}, - 'max_nics_count': {'key': 'maxNicsCount', 'type': 'int'}, - 'errors': {'key': 'errors', 'type': '[ComputeSizeErrorDetails]'}, - 'high_iops_supported': {'key': 'highIopsSupported', 'type': 'str'}, - 'hyper_v_generations': {'key': 'hyperVGenerations', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetComputeSizeProperties, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.cpu_cores_count = kwargs.get('cpu_cores_count', None) - self.v_cpus_available = None - self.memory_in_gb = kwargs.get('memory_in_gb', None) - self.max_data_disk_count = kwargs.get('max_data_disk_count', None) - self.max_nics_count = kwargs.get('max_nics_count', None) - self.errors = kwargs.get('errors', None) - self.high_iops_supported = kwargs.get('high_iops_supported', None) - self.hyper_v_generations = kwargs.get('hyper_v_generations', None) - - -class TestFailoverCleanupInput(msrest.serialization.Model): - """Input definition for test failover cleanup. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Test failover cleanup input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'TestFailoverCleanupInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TestFailoverCleanupInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class TestFailoverCleanupInputProperties(msrest.serialization.Model): - """Input definition for test failover cleanup input properties. - - :param comments: Test failover cleanup comments. - :type comments: str - """ - - _validation = { - 'comments': {'max_length': 1024, 'min_length': 0}, - } - - _attribute_map = { - 'comments': {'key': 'comments', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TestFailoverCleanupInputProperties, self).__init__(**kwargs) - self.comments = kwargs.get('comments', None) - - -class TestFailoverInput(msrest.serialization.Model): - """Input definition for test failover. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Test failover input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'TestFailoverInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TestFailoverInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class TestFailoverInputProperties(msrest.serialization.Model): - """Input definition for test failover input properties. - - :param failover_direction: Test failover direction. - :type failover_direction: str - :param network_type: Network type to be used for test failover. - :type network_type: str - :param network_id: The id of the network to be used for test failover. - :type network_id: str - :param provider_specific_details: Provider specific settings. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput - """ - - _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'network_type': {'key': 'networkType', 'type': 'str'}, - 'network_id': {'key': 'networkId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'TestFailoverProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(TestFailoverInputProperties, self).__init__(**kwargs) - self.failover_direction = kwargs.get('failover_direction', None) - self.network_type = kwargs.get('network_type', None) - self.network_id = kwargs.get('network_id', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class TestFailoverJobDetails(JobDetails): - """This class represents the details for a test failover job. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - :param test_failover_status: The test failover status. - :type test_failover_status: str - :param comments: The test failover comments. - :type comments: str - :param network_name: The test network name. - :type network_name: str - :param network_friendly_name: The test network friendly name. - :type network_friendly_name: str - :param network_type: The test network type (see TestFailoverInput enum for possible values). - :type network_type: str - :param protected_item_details: The test VM details. - :type protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - 'test_failover_status': {'key': 'testFailoverStatus', 'type': 'str'}, - 'comments': {'key': 'comments', 'type': 'str'}, - 'network_name': {'key': 'networkName', 'type': 'str'}, - 'network_friendly_name': {'key': 'networkFriendlyName', 'type': 'str'}, - 'network_type': {'key': 'networkType', 'type': 'str'}, - 'protected_item_details': {'key': 'protectedItemDetails', 'type': '[FailoverReplicationProtectedItemDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(TestFailoverJobDetails, self).__init__(**kwargs) - self.instance_type = 'TestFailoverJobDetails' # type: str - self.test_failover_status = kwargs.get('test_failover_status', None) - self.comments = kwargs.get('comments', None) - self.network_name = kwargs.get('network_name', None) - self.network_friendly_name = kwargs.get('network_friendly_name', None) - self.network_type = kwargs.get('network_type', None) - self.protected_item_details = kwargs.get('protected_item_details', None) - - -class TestMigrateCleanupInput(msrest.serialization.Model): - """Input for test migrate cleanup. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Test migrate cleanup input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'TestMigrateCleanupInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TestMigrateCleanupInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class TestMigrateCleanupInputProperties(msrest.serialization.Model): - """Test migrate cleanup input properties. - - :param comments: Test migrate cleanup comments. - :type comments: str - """ - - _validation = { - 'comments': {'max_length': 1024, 'min_length': 0}, - } - - _attribute_map = { - 'comments': {'key': 'comments', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TestMigrateCleanupInputProperties, self).__init__(**kwargs) - self.comments = kwargs.get('comments', None) - - -class TestMigrateInput(msrest.serialization.Model): - """Input for test migrate. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Test migrate input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'TestMigrateInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TestMigrateInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class TestMigrateInputProperties(msrest.serialization.Model): - """Test migrate input properties. - - All required parameters must be populated in order to send to Azure. - - :param provider_specific_details: Required. The provider specific details. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput - """ - - _validation = { - 'provider_specific_details': {'required': True}, - } - - _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'TestMigrateProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(TestMigrateInputProperties, self).__init__(**kwargs) - self.provider_specific_details = kwargs['provider_specific_details'] - - -class TestMigrateProviderSpecificInput(msrest.serialization.Model): - """Test migrate provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtTestMigrateInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtTestMigrateInput'} - } - - def __init__( - self, - **kwargs - ): - super(TestMigrateProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class UnplannedFailoverInput(msrest.serialization.Model): - """Input definition for unplanned failover. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Unplanned failover input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UnplannedFailoverInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UnplannedFailoverInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class UnplannedFailoverInputProperties(msrest.serialization.Model): - """Input definition for unplanned failover input properties. - - :param failover_direction: Failover direction. - :type failover_direction: str - :param source_site_operations: Source site operations status. - :type source_site_operations: str - :param provider_specific_details: Provider specific settings. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput - """ - - _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'source_site_operations': {'key': 'sourceSiteOperations', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'UnplannedFailoverProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(UnplannedFailoverInputProperties, self).__init__(**kwargs) - self.failover_direction = kwargs.get('failover_direction', None) - self.source_site_operations = kwargs.get('source_site_operations', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class UpdateApplianceForReplicationProtectedItemInput(msrest.serialization.Model): - """Update appliance for replication protected item input. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Update appliance replication protected item properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateApplianceForReplicationProtectedItemInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateApplianceForReplicationProtectedItemInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class UpdateApplianceForReplicationProtectedItemInputProperties(msrest.serialization.Model): - """Update appliance for protected item input properties. - - All required parameters must be populated in order to send to Azure. - - :param target_appliance_id: Required. The target appliance Id. - :type target_appliance_id: str - :param provider_specific_details: Required. The provider specific input to update replication - protected item. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput - """ - - _validation = { - 'target_appliance_id': {'required': True}, - 'provider_specific_details': {'required': True}, - } - - _attribute_map = { - 'target_appliance_id': {'key': 'targetApplianceId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'UpdateApplianceForReplicationProtectedItemProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateApplianceForReplicationProtectedItemInputProperties, self).__init__(**kwargs) - self.target_appliance_id = kwargs['target_appliance_id'] - self.provider_specific_details = kwargs['provider_specific_details'] - - -class UpdateDiskInput(msrest.serialization.Model): - """Disk input for update. - - All required parameters must be populated in order to send to Azure. - - :param disk_id: Required. The disk Id. - :type disk_id: str - :param target_disk_name: The target disk name. - :type target_disk_name: str - """ - - _validation = { - 'disk_id': {'required': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateDiskInput, self).__init__(**kwargs) - self.disk_id = kwargs['disk_id'] - self.target_disk_name = kwargs.get('target_disk_name', None) - - -class UpdateMigrationItemInput(msrest.serialization.Model): - """Update migration item input. - - :param properties: Update migration item input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateMigrationItemInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateMigrationItemInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class UpdateMigrationItemInputProperties(msrest.serialization.Model): - """Update migration item input properties. - - All required parameters must be populated in order to send to Azure. - - :param provider_specific_details: Required. The provider specific input to update migration - item. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput - """ - - _validation = { - 'provider_specific_details': {'required': True}, - } - - _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'UpdateMigrationItemProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateMigrationItemInputProperties, self).__init__(**kwargs) - self.provider_specific_details = kwargs['provider_specific_details'] - - -class UpdateMigrationItemProviderSpecificInput(msrest.serialization.Model): - """Update migration item provider specific input. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtUpdateMigrationItemInput. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtUpdateMigrationItemInput'} - } - - def __init__( - self, - **kwargs - ): - super(UpdateMigrationItemProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = None # type: Optional[str] - - -class UpdateMobilityServiceRequest(msrest.serialization.Model): - """Request to update the mobility service on a protected item. - - :param properties: The properties of the update mobility service request. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequestProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateMobilityServiceRequestProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateMobilityServiceRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class UpdateMobilityServiceRequestProperties(msrest.serialization.Model): - """The properties of an update mobility service request. - - :param run_as_account_id: The CS run as account Id. - :type run_as_account_id: str - """ - - _attribute_map = { - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateMobilityServiceRequestProperties, self).__init__(**kwargs) - self.run_as_account_id = kwargs.get('run_as_account_id', None) - - -class UpdateNetworkMappingInput(msrest.serialization.Model): - """Update network mapping input. - - :param properties: The input properties needed to update network mapping. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateNetworkMappingInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateNetworkMappingInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class UpdateNetworkMappingInputProperties(msrest.serialization.Model): - """Common input details for network mapping operation. - - :param recovery_fabric_name: Recovery fabric name. - :type recovery_fabric_name: str - :param recovery_network_id: Recovery network Id. - :type recovery_network_id: str - :param fabric_specific_details: Fabrics specific input network Id. - :type fabric_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput - """ - - _attribute_map = { - 'recovery_fabric_name': {'key': 'recoveryFabricName', 'type': 'str'}, - 'recovery_network_id': {'key': 'recoveryNetworkId', 'type': 'str'}, - 'fabric_specific_details': {'key': 'fabricSpecificDetails', 'type': 'FabricSpecificUpdateNetworkMappingInput'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateNetworkMappingInputProperties, self).__init__(**kwargs) - self.recovery_fabric_name = kwargs.get('recovery_fabric_name', None) - self.recovery_network_id = kwargs.get('recovery_network_id', None) - self.fabric_specific_details = kwargs.get('fabric_specific_details', None) - - -class UpdatePolicyInput(msrest.serialization.Model): - """Update policy input. - - :param properties: The ReplicationProviderSettings. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdatePolicyInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdatePolicyInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class UpdatePolicyInputProperties(msrest.serialization.Model): - """Policy update properties. - - :param replication_provider_settings: The ReplicationProviderSettings. - :type replication_provider_settings: - ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput - """ - - _attribute_map = { - 'replication_provider_settings': {'key': 'replicationProviderSettings', 'type': 'PolicyProviderSpecificInput'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdatePolicyInputProperties, self).__init__(**kwargs) - self.replication_provider_settings = kwargs.get('replication_provider_settings', None) - - -class UpdateProtectionContainerMappingInput(msrest.serialization.Model): - """Container pairing update input. - - :param properties: Update protection container mapping input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateProtectionContainerMappingInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateProtectionContainerMappingInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class UpdateProtectionContainerMappingInputProperties(msrest.serialization.Model): - """Container pairing update input. - - :param provider_specific_input: Provider specific input for updating protection container - mapping. - :type provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificUpdateContainerMappingInput - """ - - _attribute_map = { - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': 'ReplicationProviderSpecificUpdateContainerMappingInput'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateProtectionContainerMappingInputProperties, self).__init__(**kwargs) - self.provider_specific_input = kwargs.get('provider_specific_input', None) - - -class UpdateRecoveryPlanInput(msrest.serialization.Model): - """Update recovery plan input class. - - :param properties: Recovery plan update properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateRecoveryPlanInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateRecoveryPlanInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class UpdateRecoveryPlanInputProperties(msrest.serialization.Model): - """Recovery plan update properties. - - :param groups: The recovery plan groups. - :type groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - """ - - _attribute_map = { - 'groups': {'key': 'groups', 'type': '[RecoveryPlanGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateRecoveryPlanInputProperties, self).__init__(**kwargs) - self.groups = kwargs.get('groups', None) - - -class UpdateReplicationProtectedItemInput(msrest.serialization.Model): - """Update replication protected item input. - - :param properties: Update replication protected item properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInputProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateReplicationProtectedItemInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateReplicationProtectedItemInput, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class UpdateReplicationProtectedItemInputProperties(msrest.serialization.Model): - """Update protected item input properties. - - :param recovery_azure_vm_name: Target Azure VM name given by the user. - :type recovery_azure_vm_name: str - :param recovery_azure_vm_size: Target Azure VM size. - :type recovery_azure_vm_size: str - :param selected_recovery_azure_network_id: Target Azure Network Id. - :type selected_recovery_azure_network_id: str - :param selected_tfo_azure_network_id: The Azure Network Id for test failover. - :type selected_tfo_azure_network_id: str - :param selected_source_nic_id: The selected source nic Id which will be used as the primary nic - during failover. - :type selected_source_nic_id: str - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param vm_nics: The list of VM nic details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicInputDetails] - :param license_type: License type. Possible values include: "NotSpecified", "NoLicenseType", - "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param recovery_availability_set_id: The target availability set Id. - :type recovery_availability_set_id: str - :param provider_specific_details: The provider specific input to update replication protected - item. - :type provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput - """ - - _attribute_map = { - 'recovery_azure_vm_name': {'key': 'recoveryAzureVMName', 'type': 'str'}, - 'recovery_azure_vm_size': {'key': 'recoveryAzureVMSize', 'type': 'str'}, - 'selected_recovery_azure_network_id': {'key': 'selectedRecoveryAzureNetworkId', 'type': 'str'}, - 'selected_tfo_azure_network_id': {'key': 'selectedTfoAzureNetworkId', 'type': 'str'}, - 'selected_source_nic_id': {'key': 'selectedSourceNicId', 'type': 'str'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicInputDetails]'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'UpdateReplicationProtectedItemProviderInput'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateReplicationProtectedItemInputProperties, self).__init__(**kwargs) - self.recovery_azure_vm_name = kwargs.get('recovery_azure_vm_name', None) - self.recovery_azure_vm_size = kwargs.get('recovery_azure_vm_size', None) - self.selected_recovery_azure_network_id = kwargs.get('selected_recovery_azure_network_id', None) - self.selected_tfo_azure_network_id = kwargs.get('selected_tfo_azure_network_id', None) - self.selected_source_nic_id = kwargs.get('selected_source_nic_id', None) - self.enable_rdp_on_target_option = kwargs.get('enable_rdp_on_target_option', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.license_type = kwargs.get('license_type', None) - self.recovery_availability_set_id = kwargs.get('recovery_availability_set_id', None) - self.provider_specific_details = kwargs.get('provider_specific_details', None) - - -class UpdateVCenterRequest(msrest.serialization.Model): - """Input required to update vCenter. - - :param properties: The update VCenter Request Properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequestProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateVCenterRequestProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateVCenterRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class UpdateVCenterRequestProperties(msrest.serialization.Model): - """The properties of an update vCenter request. - - :param friendly_name: The friendly name of the vCenter. - :type friendly_name: str - :param ip_address: The IP address of the vCenter to be discovered. - :type ip_address: str - :param process_server_id: The process server Id from where the update can be orchestrated. - :type process_server_id: str - :param port: The port number for discovery. - :type port: str - :param run_as_account_id: The CS account Id which has privileges to update the vCenter. - :type run_as_account_id: str - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateVCenterRequestProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.ip_address = kwargs.get('ip_address', None) - self.process_server_id = kwargs.get('process_server_id', None) - self.port = kwargs.get('port', None) - self.run_as_account_id = kwargs.get('run_as_account_id', None) - - -class VaultHealthDetails(Resource): - """Vault health details definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The vault health related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VaultHealthProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultHealthDetails, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class VaultHealthProperties(msrest.serialization.Model): - """class to define the health summary of the Vault. - - :param vault_errors: The list of errors on the vault. - :type vault_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param protected_items_health: The list of the health detail of the protected items in the - vault. - :type protected_items_health: - ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - :param fabrics_health: The list of the health detail of the fabrics in the vault. - :type fabrics_health: ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - :param containers_health: The list of the health detail of the containers in the vault. - :type containers_health: ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - """ - - _attribute_map = { - 'vault_errors': {'key': 'vaultErrors', 'type': '[HealthError]'}, - 'protected_items_health': {'key': 'protectedItemsHealth', 'type': 'ResourceHealthSummary'}, - 'fabrics_health': {'key': 'fabricsHealth', 'type': 'ResourceHealthSummary'}, - 'containers_health': {'key': 'containersHealth', 'type': 'ResourceHealthSummary'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultHealthProperties, self).__init__(**kwargs) - self.vault_errors = kwargs.get('vault_errors', None) - self.protected_items_health = kwargs.get('protected_items_health', None) - self.fabrics_health = kwargs.get('fabrics_health', None) - self.containers_health = kwargs.get('containers_health', None) - - -class VaultSetting(Resource): - """Vault setting. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The vault setting properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VaultSettingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultSetting, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class VaultSettingCollection(msrest.serialization.Model): - """Vault setting collection. - - :param value: The list of vault setting. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VaultSetting]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultSettingCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class VaultSettingCreationInput(msrest.serialization.Model): - """Input to create vault setting. - - All required parameters must be populated in order to send to Azure. - - :param properties: Required. Vault setting creation input properties. - :type properties: - ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'VaultSettingCreationInputProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultSettingCreationInput, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class VaultSettingCreationInputProperties(msrest.serialization.Model): - """Input to create vault setting. - - :param migration_solution_id: The migration solution Id. - :type migration_solution_id: str - :param vmware_to_azure_provider_type: VMware to Azure provider type. - :type vmware_to_azure_provider_type: str - """ - - _attribute_map = { - 'migration_solution_id': {'key': 'migrationSolutionId', 'type': 'str'}, - 'vmware_to_azure_provider_type': {'key': 'vmwareToAzureProviderType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultSettingCreationInputProperties, self).__init__(**kwargs) - self.migration_solution_id = kwargs.get('migration_solution_id', None) - self.vmware_to_azure_provider_type = kwargs.get('vmware_to_azure_provider_type', None) - - -class VaultSettingProperties(msrest.serialization.Model): - """Vault setting properties. - - :param migration_solution_id: The migration solution ARM Id. - :type migration_solution_id: str - :param vmware_to_azure_provider_type: VMware to Azure provider type. - :type vmware_to_azure_provider_type: str - """ - - _attribute_map = { - 'migration_solution_id': {'key': 'migrationSolutionId', 'type': 'str'}, - 'vmware_to_azure_provider_type': {'key': 'vmwareToAzureProviderType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultSettingProperties, self).__init__(**kwargs) - self.migration_solution_id = kwargs.get('migration_solution_id', None) - self.vmware_to_azure_provider_type = kwargs.get('vmware_to_azure_provider_type', None) - - -class VCenter(Resource): - """vCenter definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: VCenter related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.VCenterProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VCenterProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VCenter, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class VCenterCollection(msrest.serialization.Model): - """Collection of vCenter details. - - :param value: The vCenter details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :param next_link: The value of next link. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VCenter]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VCenterCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class VCenterProperties(msrest.serialization.Model): - """vCenter properties. - - :param friendly_name: Friendly name of the vCenter. - :type friendly_name: str - :param internal_id: VCenter internal ID. - :type internal_id: str - :param last_heartbeat: The time when the last heartbeat was received by vCenter. - :type last_heartbeat: ~datetime.datetime - :param discovery_status: The VCenter discovery status. - :type discovery_status: str - :param process_server_id: The process server Id. - :type process_server_id: str - :param ip_address: The IP address of the vCenter. - :type ip_address: str - :param infrastructure_id: The infrastructure Id of vCenter. - :type infrastructure_id: str - :param port: The port number for discovery. - :type port: str - :param run_as_account_id: The account Id which has privileges to discover the vCenter. - :type run_as_account_id: str - :param fabric_arm_resource_name: The ARM resource name of the fabric containing this VCenter. - :type fabric_arm_resource_name: str - :param health_errors: The health errors for this VCenter. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'internal_id': {'key': 'internalId', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'discovery_status': {'key': 'discoveryStatus', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'infrastructure_id': {'key': 'infrastructureId', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'fabric_arm_resource_name': {'key': 'fabricArmResourceName', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - } - - def __init__( - self, - **kwargs - ): - super(VCenterProperties, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.internal_id = kwargs.get('internal_id', None) - self.last_heartbeat = kwargs.get('last_heartbeat', None) - self.discovery_status = kwargs.get('discovery_status', None) - self.process_server_id = kwargs.get('process_server_id', None) - self.ip_address = kwargs.get('ip_address', None) - self.infrastructure_id = kwargs.get('infrastructure_id', None) - self.port = kwargs.get('port', None) - self.run_as_account_id = kwargs.get('run_as_account_id', None) - self.fabric_arm_resource_name = kwargs.get('fabric_arm_resource_name', None) - self.health_errors = kwargs.get('health_errors', None) - - -class VersionDetails(msrest.serialization.Model): - """Version related details. - - :param version: The agent version. - :type version: str - :param expiry_date: Version expiry date. - :type expiry_date: ~datetime.datetime - :param status: A value indicating whether security update required. Possible values include: - "Supported", "NotSupported", "Deprecated", "UpdateRequired", "SecurityUpdateRequired". - :type status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentVersionStatus - """ - - _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'expiry_date': {'key': 'expiryDate', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VersionDetails, self).__init__(**kwargs) - self.version = kwargs.get('version', None) - self.expiry_date = kwargs.get('expiry_date', None) - self.status = kwargs.get('status', None) - - -class VirtualMachineTaskDetails(JobTaskDetails): - """This class represents the virtual machine task details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param job_task: The job entity. - :type job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - :param skipped_reason: The skipped reason. - :type skipped_reason: str - :param skipped_reason_string: The skipped reason string. - :type skipped_reason_string: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'job_task': {'key': 'jobTask', 'type': 'JobEntity'}, - 'skipped_reason': {'key': 'skippedReason', 'type': 'str'}, - 'skipped_reason_string': {'key': 'skippedReasonString', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineTaskDetails, self).__init__(**kwargs) - self.instance_type = 'VirtualMachineTaskDetails' # type: str - self.skipped_reason = kwargs.get('skipped_reason', None) - self.skipped_reason_string = kwargs.get('skipped_reason_string', None) - - -class VmmDetails(FabricSpecificDetails): - """VMM fabric specific details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmmDetails, self).__init__(**kwargs) - self.instance_type = 'VMM' # type: str - - -class VmmToAzureCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput): - """Create network mappings input properties/behavior specific to Vmm to Azure Network mapping. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmmToAzureCreateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'VmmToAzure' # type: str - - -class VmmToAzureNetworkMappingSettings(NetworkMappingFabricSpecificSettings): - """E2A Network Mapping fabric specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmmToAzureNetworkMappingSettings, self).__init__(**kwargs) - self.instance_type = 'VmmToAzure' # type: str - - -class VmmToAzureUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput): - """Update network mappings input properties/behavior specific to vmm to azure. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmmToAzureUpdateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'VmmToAzure' # type: str - - -class VmmToVmmCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput): - """Create network mappings input properties/behavior specific to vmm to vmm Network mapping. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmmToVmmCreateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'VmmToVmm' # type: str - - -class VmmToVmmNetworkMappingSettings(NetworkMappingFabricSpecificSettings): - """E2E Network Mapping fabric specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmmToVmmNetworkMappingSettings, self).__init__(**kwargs) - self.instance_type = 'VmmToVmm' # type: str - - -class VmmToVmmUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput): - """Update network mappings input properties/behavior specific to vmm to vmm. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmmToVmmUpdateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'VmmToVmm' # type: str - - -class VmmVirtualMachineDetails(HyperVVirtualMachineDetails): - """VMM fabric provider specific VM settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param source_item_id: The source id of the object. - :type source_item_id: str - :param generation: The id of the object in fabric. - :type generation: str - :param os_details: The Last replication time. - :type os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :param disk_details: The Last successful failover time. - :type disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - :param has_physical_disk: A value indicating whether the VM has a physical disk attached. - String value of SrsDataContract.PresenceStatus enum. Possible values include: "Unknown", - "Present", "NotPresent". - :type has_physical_disk: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :param has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter - attached. String value of SrsDataContract.PresenceStatus enum. Possible values include: - "Unknown", "Present", "NotPresent". - :type has_fibre_channel_adapter: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :param has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String - value of SrsDataContract.PresenceStatus enum. Possible values include: "Unknown", "Present", - "NotPresent". - :type has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'source_item_id': {'key': 'sourceItemId', 'type': 'str'}, - 'generation': {'key': 'generation', 'type': 'str'}, - 'os_details': {'key': 'osDetails', 'type': 'OSDetails'}, - 'disk_details': {'key': 'diskDetails', 'type': '[DiskDetails]'}, - 'has_physical_disk': {'key': 'hasPhysicalDisk', 'type': 'str'}, - 'has_fibre_channel_adapter': {'key': 'hasFibreChannelAdapter', 'type': 'str'}, - 'has_shared_vhd': {'key': 'hasSharedVhd', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmmVirtualMachineDetails, self).__init__(**kwargs) - self.instance_type = 'VmmVirtualMachine' # type: str - - -class VMNicDetails(msrest.serialization.Model): - """Hyper V VM network details. - - :param nic_id: The nic Id. - :type nic_id: str - :param replica_nic_id: The replica nic Id. - :type replica_nic_id: str - :param source_nic_arm_id: The source nic ARM Id. - :type source_nic_arm_id: str - :param v_m_network_name: VM network name. - :type v_m_network_name: str - :param recovery_vm_network_id: Recovery VM network Id. - :type recovery_vm_network_id: str - :param ip_configs: The IP configurations of the NIC. - :type ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigDetails] - :param selection_type: Selection type for failover. - :type selection_type: str - :param recovery_network_security_group_id: The id of the NSG associated with the NIC. - :type recovery_network_security_group_id: str - :param enable_accelerated_networking_on_recovery: A value indicating whether the NIC has - accelerated networking enabled. - :type enable_accelerated_networking_on_recovery: bool - :param tfo_vm_network_id: The network to be used by NIC during test failover. - :type tfo_vm_network_id: str - :param tfo_network_security_group_id: The NSG to be used by NIC during test failover. - :type tfo_network_security_group_id: str - :param enable_accelerated_networking_on_tfo: Whether the TFO NIC has accelerated networking - enabled. - :type enable_accelerated_networking_on_tfo: bool - :param recovery_nic_name: The name of the NIC to be used when creating target NICs. - :type recovery_nic_name: str - :param recovery_nic_resource_group_name: The resource group of the NIC to be used when creating - target NICs. - :type recovery_nic_resource_group_name: str - :param reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused - during failover subject to availability. - :type reuse_existing_nic: bool - :param tfo_recovery_nic_name: The name of the NIC to be used when creating target NICs in TFO. - :type tfo_recovery_nic_name: str - :param tfo_recovery_nic_resource_group_name: The resource group of the NIC to be used when - creating target NICs in TFO. - :type tfo_recovery_nic_resource_group_name: str - :param tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be - reused during test failover subject to availability. - :type tfo_reuse_existing_nic: bool - :param target_nic_name: Target NIC name. - :type target_nic_name: str - """ - - _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'replica_nic_id': {'key': 'replicaNicId', 'type': 'str'}, - 'source_nic_arm_id': {'key': 'sourceNicArmId', 'type': 'str'}, - 'v_m_network_name': {'key': 'vMNetworkName', 'type': 'str'}, - 'recovery_vm_network_id': {'key': 'recoveryVMNetworkId', 'type': 'str'}, - 'ip_configs': {'key': 'ipConfigs', 'type': '[IPConfigDetails]'}, - 'selection_type': {'key': 'selectionType', 'type': 'str'}, - 'recovery_network_security_group_id': {'key': 'recoveryNetworkSecurityGroupId', 'type': 'str'}, - 'enable_accelerated_networking_on_recovery': {'key': 'enableAcceleratedNetworkingOnRecovery', 'type': 'bool'}, - 'tfo_vm_network_id': {'key': 'tfoVMNetworkId', 'type': 'str'}, - 'tfo_network_security_group_id': {'key': 'tfoNetworkSecurityGroupId', 'type': 'str'}, - 'enable_accelerated_networking_on_tfo': {'key': 'enableAcceleratedNetworkingOnTfo', 'type': 'bool'}, - 'recovery_nic_name': {'key': 'recoveryNicName', 'type': 'str'}, - 'recovery_nic_resource_group_name': {'key': 'recoveryNicResourceGroupName', 'type': 'str'}, - 'reuse_existing_nic': {'key': 'reuseExistingNic', 'type': 'bool'}, - 'tfo_recovery_nic_name': {'key': 'tfoRecoveryNicName', 'type': 'str'}, - 'tfo_recovery_nic_resource_group_name': {'key': 'tfoRecoveryNicResourceGroupName', 'type': 'str'}, - 'tfo_reuse_existing_nic': {'key': 'tfoReuseExistingNic', 'type': 'bool'}, - 'target_nic_name': {'key': 'targetNicName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMNicDetails, self).__init__(**kwargs) - self.nic_id = kwargs.get('nic_id', None) - self.replica_nic_id = kwargs.get('replica_nic_id', None) - self.source_nic_arm_id = kwargs.get('source_nic_arm_id', None) - self.v_m_network_name = kwargs.get('v_m_network_name', None) - self.recovery_vm_network_id = kwargs.get('recovery_vm_network_id', None) - self.ip_configs = kwargs.get('ip_configs', None) - self.selection_type = kwargs.get('selection_type', None) - self.recovery_network_security_group_id = kwargs.get('recovery_network_security_group_id', None) - self.enable_accelerated_networking_on_recovery = kwargs.get('enable_accelerated_networking_on_recovery', None) - self.tfo_vm_network_id = kwargs.get('tfo_vm_network_id', None) - self.tfo_network_security_group_id = kwargs.get('tfo_network_security_group_id', None) - self.enable_accelerated_networking_on_tfo = kwargs.get('enable_accelerated_networking_on_tfo', None) - self.recovery_nic_name = kwargs.get('recovery_nic_name', None) - self.recovery_nic_resource_group_name = kwargs.get('recovery_nic_resource_group_name', None) - self.reuse_existing_nic = kwargs.get('reuse_existing_nic', False) - self.tfo_recovery_nic_name = kwargs.get('tfo_recovery_nic_name', None) - self.tfo_recovery_nic_resource_group_name = kwargs.get('tfo_recovery_nic_resource_group_name', None) - self.tfo_reuse_existing_nic = kwargs.get('tfo_reuse_existing_nic', False) - self.target_nic_name = kwargs.get('target_nic_name', None) - - -class VMNicInputDetails(msrest.serialization.Model): - """Hyper V VM network input details. - - :param nic_id: The nic Id. - :type nic_id: str - :param ip_configs: The IP configurations to be used by NIC during test failover and failover. - :type ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigInputDetails] - :param selection_type: Selection type for failover. - :type selection_type: str - :param recovery_network_security_group_id: The id of the NSG associated with the NIC. - :type recovery_network_security_group_id: str - :param enable_accelerated_networking_on_recovery: Whether the NIC has accelerated networking - enabled. - :type enable_accelerated_networking_on_recovery: bool - :param tfo_network_security_group_id: The NSG to be used by NIC during test failover. - :type tfo_network_security_group_id: str - :param enable_accelerated_networking_on_tfo: Whether the test NIC has accelerated networking - enabled. - :type enable_accelerated_networking_on_tfo: bool - :param recovery_nic_name: The name of the NIC to be used when creating target NICs. - :type recovery_nic_name: str - :param recovery_nic_resource_group_name: The resource group of the NIC to be used when creating - target NICs. - :type recovery_nic_resource_group_name: str - :param reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused - during failover subject to availability. - :type reuse_existing_nic: bool - :param tfo_nic_name: The name of the NIC to be used when creating target NICs in TFO. - :type tfo_nic_name: str - :param tfo_nic_resource_group_name: The resource group of the NIC to be used when creating - target NICs in TFO. - :type tfo_nic_resource_group_name: str - :param tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be - reused during test failover subject to availability. - :type tfo_reuse_existing_nic: bool - :param target_nic_name: Target NIC name. - :type target_nic_name: str - """ - - _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'ip_configs': {'key': 'ipConfigs', 'type': '[IPConfigInputDetails]'}, - 'selection_type': {'key': 'selectionType', 'type': 'str'}, - 'recovery_network_security_group_id': {'key': 'recoveryNetworkSecurityGroupId', 'type': 'str'}, - 'enable_accelerated_networking_on_recovery': {'key': 'enableAcceleratedNetworkingOnRecovery', 'type': 'bool'}, - 'tfo_network_security_group_id': {'key': 'tfoNetworkSecurityGroupId', 'type': 'str'}, - 'enable_accelerated_networking_on_tfo': {'key': 'enableAcceleratedNetworkingOnTfo', 'type': 'bool'}, - 'recovery_nic_name': {'key': 'recoveryNicName', 'type': 'str'}, - 'recovery_nic_resource_group_name': {'key': 'recoveryNicResourceGroupName', 'type': 'str'}, - 'reuse_existing_nic': {'key': 'reuseExistingNic', 'type': 'bool'}, - 'tfo_nic_name': {'key': 'tfoNicName', 'type': 'str'}, - 'tfo_nic_resource_group_name': {'key': 'tfoNicResourceGroupName', 'type': 'str'}, - 'tfo_reuse_existing_nic': {'key': 'tfoReuseExistingNic', 'type': 'bool'}, - 'target_nic_name': {'key': 'targetNicName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMNicInputDetails, self).__init__(**kwargs) - self.nic_id = kwargs.get('nic_id', None) - self.ip_configs = kwargs.get('ip_configs', None) - self.selection_type = kwargs.get('selection_type', None) - self.recovery_network_security_group_id = kwargs.get('recovery_network_security_group_id', None) - self.enable_accelerated_networking_on_recovery = kwargs.get('enable_accelerated_networking_on_recovery', None) - self.tfo_network_security_group_id = kwargs.get('tfo_network_security_group_id', None) - self.enable_accelerated_networking_on_tfo = kwargs.get('enable_accelerated_networking_on_tfo', None) - self.recovery_nic_name = kwargs.get('recovery_nic_name', None) - self.recovery_nic_resource_group_name = kwargs.get('recovery_nic_resource_group_name', None) - self.reuse_existing_nic = kwargs.get('reuse_existing_nic', None) - self.tfo_nic_name = kwargs.get('tfo_nic_name', None) - self.tfo_nic_resource_group_name = kwargs.get('tfo_nic_resource_group_name', None) - self.tfo_reuse_existing_nic = kwargs.get('tfo_reuse_existing_nic', None) - self.target_nic_name = kwargs.get('target_nic_name', None) - - -class VmNicUpdatesTaskDetails(TaskTypeDetails): - """This class represents the vm NicUpdates task details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param vm_id: Virtual machine Id. - :type vm_id: str - :param nic_id: Nic Id. - :type nic_id: str - :param name: Name of the Nic. - :type name: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmNicUpdatesTaskDetails, self).__init__(**kwargs) - self.instance_type = 'VmNicUpdatesTaskDetails' # type: str - self.vm_id = kwargs.get('vm_id', None) - self.nic_id = kwargs.get('nic_id', None) - self.name = kwargs.get('name', None) - - -class VMwareCbtContainerCreationInput(ReplicationProviderSpecificContainerCreationInput): - """VMwareCbt container creation input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtContainerCreationInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - - -class VMwareCbtContainerMappingInput(ReplicationProviderSpecificContainerMappingInput): - """VMwareCbt container mapping input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param key_vault_id: Required. The target key vault ARM Id. - :type key_vault_id: str - :param key_vault_uri: Required. The target key vault URL. - :type key_vault_uri: str - :param storage_account_id: Required. The storage account ARM Id. - :type storage_account_id: str - :param storage_account_sas_secret_name: Required. The secret name of the storage account. - :type storage_account_sas_secret_name: str - :param service_bus_connection_string_secret_name: Required. The secret name of the service bus - connection string. - :type service_bus_connection_string_secret_name: str - :param target_location: Required. The target location. - :type target_location: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'key_vault_id': {'required': True}, - 'key_vault_uri': {'required': True}, - 'storage_account_id': {'required': True}, - 'storage_account_sas_secret_name': {'required': True}, - 'service_bus_connection_string_secret_name': {'required': True}, - 'target_location': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'storage_account_sas_secret_name': {'key': 'storageAccountSasSecretName', 'type': 'str'}, - 'service_bus_connection_string_secret_name': {'key': 'serviceBusConnectionStringSecretName', 'type': 'str'}, - 'target_location': {'key': 'targetLocation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtContainerMappingInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.key_vault_id = kwargs['key_vault_id'] - self.key_vault_uri = kwargs['key_vault_uri'] - self.storage_account_id = kwargs['storage_account_id'] - self.storage_account_sas_secret_name = kwargs['storage_account_sas_secret_name'] - self.service_bus_connection_string_secret_name = kwargs['service_bus_connection_string_secret_name'] - self.target_location = kwargs['target_location'] - - -class VMwareCbtDiskInput(msrest.serialization.Model): - """VMwareCbt disk input. - - All required parameters must be populated in order to send to Azure. - - :param disk_id: Required. The disk Id. - :type disk_id: str - :param disk_type: The disk type. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param is_os_disk: Required. A value indicating whether the disk is the OS disk. - :type is_os_disk: str - :param log_storage_account_id: Required. The log storage account ARM Id. - :type log_storage_account_id: str - :param log_storage_account_sas_secret_name: Required. The key vault secret name of the log - storage account. - :type log_storage_account_sas_secret_name: str - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str - """ - - _validation = { - 'disk_id': {'required': True}, - 'is_os_disk': {'required': True}, - 'log_storage_account_id': {'required': True}, - 'log_storage_account_sas_secret_name': {'required': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'log_storage_account_sas_secret_name': {'key': 'logStorageAccountSasSecretName', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtDiskInput, self).__init__(**kwargs) - self.disk_id = kwargs['disk_id'] - self.disk_type = kwargs.get('disk_type', None) - self.is_os_disk = kwargs['is_os_disk'] - self.log_storage_account_id = kwargs['log_storage_account_id'] - self.log_storage_account_sas_secret_name = kwargs['log_storage_account_sas_secret_name'] - self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) - - -class VMwareCbtEnableMigrationInput(EnableMigrationProviderSpecificInput): - """VMwareCbt specific enable migration input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param vmware_machine_id: Required. The ARM Id of the VM discovered in VMware. - :type vmware_machine_id: str - :param disks_to_include: Required. The disks to include list. - :type disks_to_include: - list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtDiskInput] - :param license_type: License type. Possible values include: "NotSpecified", "NoLicenseType", - "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param data_mover_run_as_account_id: Required. The data mover run as account Id. - :type data_mover_run_as_account_id: str - :param snapshot_run_as_account_id: Required. The snapshot run as account Id. - :type snapshot_run_as_account_id: str - :param target_vm_name: The target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_resource_group_id: Required. The target resource group ARM Id. - :type target_resource_group_id: str - :param target_network_id: Required. The target network ARM Id. - :type target_network_id: str - :param target_subnet_name: The target subnet name. - :type target_subnet_name: str - :param target_availability_set_id: The target availability set ARM Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group ARM Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param perform_auto_resync: A value indicating whether auto resync is to be done. - :type perform_auto_resync: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_disk_tags: The tags for the seed disks. - :type seed_disk_tags: dict[str, str] - :param target_disk_tags: The tags for the target disks. - :type target_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - 'vmware_machine_id': {'required': True}, - 'disks_to_include': {'required': True}, - 'data_mover_run_as_account_id': {'required': True}, - 'snapshot_run_as_account_id': {'required': True}, - 'target_resource_group_id': {'required': True}, - 'target_network_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_machine_id': {'key': 'vmwareMachineId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[VMwareCbtDiskInput]'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'data_mover_run_as_account_id': {'key': 'dataMoverRunAsAccountId', 'type': 'str'}, - 'snapshot_run_as_account_id': {'key': 'snapshotRunAsAccountId', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'perform_auto_resync': {'key': 'performAutoResync', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_disk_tags': {'key': 'seedDiskTags', 'type': '{str}'}, - 'target_disk_tags': {'key': 'targetDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtEnableMigrationInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.vmware_machine_id = kwargs['vmware_machine_id'] - self.disks_to_include = kwargs['disks_to_include'] - self.license_type = kwargs.get('license_type', None) - self.sql_server_license_type = kwargs.get('sql_server_license_type', None) - self.data_mover_run_as_account_id = kwargs['data_mover_run_as_account_id'] - self.snapshot_run_as_account_id = kwargs['snapshot_run_as_account_id'] - self.target_vm_name = kwargs.get('target_vm_name', None) - self.target_vm_size = kwargs.get('target_vm_size', None) - self.target_resource_group_id = kwargs['target_resource_group_id'] - self.target_network_id = kwargs['target_network_id'] - self.target_subnet_name = kwargs.get('target_subnet_name', None) - self.target_availability_set_id = kwargs.get('target_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.target_boot_diagnostics_storage_account_id = kwargs.get('target_boot_diagnostics_storage_account_id', None) - self.perform_auto_resync = kwargs.get('perform_auto_resync', None) - self.target_vm_tags = kwargs.get('target_vm_tags', None) - self.seed_disk_tags = kwargs.get('seed_disk_tags', None) - self.target_disk_tags = kwargs.get('target_disk_tags', None) - self.target_nic_tags = kwargs.get('target_nic_tags', None) - - -class VMwareCbtEventDetails(EventProviderSpecificDetails): - """Event details for VMwareCbt provider. - - 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. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :ivar migration_item_name: The migration item name. - :vartype migration_item_name: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'migration_item_name': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'migration_item_name': {'key': 'migrationItemName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtEventDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.migration_item_name = None - - -class VMwareCbtMigrateInput(MigrateProviderSpecificInput): - """VMwareCbt specific migrate input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param perform_shutdown: Required. A value indicating whether VM is to be shutdown. - :type perform_shutdown: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'perform_shutdown': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'perform_shutdown': {'key': 'performShutdown', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtMigrateInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.perform_shutdown = kwargs['perform_shutdown'] - - -class VMwareCbtMigrationDetails(MigrationProviderSpecificSettings): - """VMwareCbt provider specific settings. - - 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. - - :param instance_type: Required. Gets the instance type.Constant filled by server. - :type instance_type: str - :ivar vmware_machine_id: The ARM Id of the VM discovered in VMware. - :vartype vmware_machine_id: str - :ivar os_type: The type of the OS on the VM. - :vartype os_type: str - :ivar firmware_type: The firmware type. - :vartype firmware_type: str - :ivar target_generation: The target generation. - :vartype target_generation: str - :param license_type: License Type of the VM to be used. - :type license_type: str - :param sql_server_license_type: The SQL Server license type. - :type sql_server_license_type: str - :ivar data_mover_run_as_account_id: The data mover run as account Id. - :vartype data_mover_run_as_account_id: str - :ivar snapshot_run_as_account_id: The snapshot run as account Id. - :vartype snapshot_run_as_account_id: str - :param target_vm_name: Target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :ivar target_location: The target location. - :vartype target_location: str - :param target_resource_group_id: The target resource group Id. - :type target_resource_group_id: str - :param target_availability_set_id: The target availability set Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param protected_disks: The list of protected disks. - :type protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtProtectedDiskDetails] - :param target_network_id: The target network Id. - :type target_network_id: str - :param vm_nics: The network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicDetails] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - :ivar migration_recovery_point_id: The recovery point Id to which the VM was migrated. - :vartype migration_recovery_point_id: str - :ivar last_recovery_point_received: The last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :ivar last_recovery_point_id: The last recovery point Id. - :vartype last_recovery_point_id: str - :ivar initial_seeding_progress_percentage: The initial seeding progress percentage. - :vartype initial_seeding_progress_percentage: int - :ivar migration_progress_percentage: The migration progress percentage. - :vartype migration_progress_percentage: int - :ivar resync_progress_percentage: The resync progress percentage. - :vartype resync_progress_percentage: int - :ivar initial_seeding_retry_count: The initial seeding retry count. - :vartype initial_seeding_retry_count: long - :ivar resync_retry_count: The resync retry count. - :vartype resync_retry_count: long - :ivar resync_required: A value indicating whether resync is required. - :vartype resync_required: str - :ivar resync_state: The resync state. Possible values include: "None", - "PreparedForResynchronization", "StartedResynchronization". - :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState - :param perform_auto_resync: A value indicating whether auto resync is to be done. - :type perform_auto_resync: str - :param seed_disk_tags: The tags for the seed disks. - :type seed_disk_tags: dict[str, str] - :param target_disk_tags: The tags for the target disks. - :type target_disk_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - 'vmware_machine_id': {'readonly': True}, - 'os_type': {'readonly': True}, - 'firmware_type': {'readonly': True}, - 'target_generation': {'readonly': True}, - 'data_mover_run_as_account_id': {'readonly': True}, - 'snapshot_run_as_account_id': {'readonly': True}, - 'target_location': {'readonly': True}, - 'migration_recovery_point_id': {'readonly': True}, - 'last_recovery_point_received': {'readonly': True}, - 'last_recovery_point_id': {'readonly': True}, - 'initial_seeding_progress_percentage': {'readonly': True}, - 'migration_progress_percentage': {'readonly': True}, - 'resync_progress_percentage': {'readonly': True}, - 'initial_seeding_retry_count': {'readonly': True}, - 'resync_retry_count': {'readonly': True}, - 'resync_required': {'readonly': True}, - 'resync_state': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_machine_id': {'key': 'vmwareMachineId', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'firmware_type': {'key': 'firmwareType', 'type': 'str'}, - 'target_generation': {'key': 'targetGeneration', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'data_mover_run_as_account_id': {'key': 'dataMoverRunAsAccountId', 'type': 'str'}, - 'snapshot_run_as_account_id': {'key': 'snapshotRunAsAccountId', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_location': {'key': 'targetLocation', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[VMwareCbtProtectedDiskDetails]'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMwareCbtNicDetails]'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - 'migration_recovery_point_id': {'key': 'migrationRecoveryPointId', 'type': 'str'}, - 'last_recovery_point_received': {'key': 'lastRecoveryPointReceived', 'type': 'iso-8601'}, - 'last_recovery_point_id': {'key': 'lastRecoveryPointId', 'type': 'str'}, - 'initial_seeding_progress_percentage': {'key': 'initialSeedingProgressPercentage', 'type': 'int'}, - 'migration_progress_percentage': {'key': 'migrationProgressPercentage', 'type': 'int'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'initial_seeding_retry_count': {'key': 'initialSeedingRetryCount', 'type': 'long'}, - 'resync_retry_count': {'key': 'resyncRetryCount', 'type': 'long'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_state': {'key': 'resyncState', 'type': 'str'}, - 'perform_auto_resync': {'key': 'performAutoResync', 'type': 'str'}, - 'seed_disk_tags': {'key': 'seedDiskTags', 'type': '{str}'}, - 'target_disk_tags': {'key': 'targetDiskTags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtMigrationDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.vmware_machine_id = None - self.os_type = None - self.firmware_type = None - self.target_generation = None - self.license_type = kwargs.get('license_type', None) - self.sql_server_license_type = kwargs.get('sql_server_license_type', None) - self.data_mover_run_as_account_id = None - self.snapshot_run_as_account_id = None - self.target_vm_name = kwargs.get('target_vm_name', None) - self.target_vm_size = kwargs.get('target_vm_size', None) - self.target_location = None - self.target_resource_group_id = kwargs.get('target_resource_group_id', None) - self.target_availability_set_id = kwargs.get('target_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.target_boot_diagnostics_storage_account_id = kwargs.get('target_boot_diagnostics_storage_account_id', None) - self.target_vm_tags = kwargs.get('target_vm_tags', None) - self.protected_disks = kwargs.get('protected_disks', None) - self.target_network_id = kwargs.get('target_network_id', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.target_nic_tags = kwargs.get('target_nic_tags', None) - self.migration_recovery_point_id = None - self.last_recovery_point_received = None - self.last_recovery_point_id = None - self.initial_seeding_progress_percentage = None - self.migration_progress_percentage = None - self.resync_progress_percentage = None - self.initial_seeding_retry_count = None - self.resync_retry_count = None - self.resync_required = None - self.resync_state = None - self.perform_auto_resync = kwargs.get('perform_auto_resync', None) - self.seed_disk_tags = kwargs.get('seed_disk_tags', None) - self.target_disk_tags = kwargs.get('target_disk_tags', None) - - -class VMwareCbtNicDetails(msrest.serialization.Model): - """VMwareCbt NIC details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar nic_id: The NIC Id. - :vartype nic_id: str - :param is_primary_nic: A value indicating whether this is the primary NIC. - :type is_primary_nic: str - :ivar source_ip_address: The source IP address. - :vartype source_ip_address: str - :ivar source_ip_address_type: The source IP address type. Possible values include: "Dynamic", - "Static". - :vartype source_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :ivar source_network_id: Source network Id. - :vartype source_network_id: str - :param target_ip_address: The target IP address. - :type target_ip_address: str - :param target_ip_address_type: The target IP address type. Possible values include: "Dynamic", - "Static". - :type target_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :param target_subnet_name: Target subnet name. - :type target_subnet_name: str - :param target_nic_name: Target NIC name. - :type target_nic_name: str - :param is_selected_for_migration: A value indicating whether this NIC is selected for - migration. - :type is_selected_for_migration: str - """ - - _validation = { - 'nic_id': {'readonly': True}, - 'source_ip_address': {'readonly': True}, - 'source_ip_address_type': {'readonly': True}, - 'source_network_id': {'readonly': True}, - } - - _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'is_primary_nic': {'key': 'isPrimaryNic', 'type': 'str'}, - 'source_ip_address': {'key': 'sourceIPAddress', 'type': 'str'}, - 'source_ip_address_type': {'key': 'sourceIPAddressType', 'type': 'str'}, - 'source_network_id': {'key': 'sourceNetworkId', 'type': 'str'}, - 'target_ip_address': {'key': 'targetIPAddress', 'type': 'str'}, - 'target_ip_address_type': {'key': 'targetIPAddressType', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'target_nic_name': {'key': 'targetNicName', 'type': 'str'}, - 'is_selected_for_migration': {'key': 'isSelectedForMigration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtNicDetails, self).__init__(**kwargs) - self.nic_id = None - self.is_primary_nic = kwargs.get('is_primary_nic', None) - self.source_ip_address = None - self.source_ip_address_type = None - self.source_network_id = None - self.target_ip_address = kwargs.get('target_ip_address', None) - self.target_ip_address_type = kwargs.get('target_ip_address_type', None) - self.target_subnet_name = kwargs.get('target_subnet_name', None) - self.target_nic_name = kwargs.get('target_nic_name', None) - self.is_selected_for_migration = kwargs.get('is_selected_for_migration', None) - - -class VMwareCbtNicInput(msrest.serialization.Model): - """VMwareCbt NIC input. - - All required parameters must be populated in order to send to Azure. - - :param nic_id: Required. The NIC Id. - :type nic_id: str - :param is_primary_nic: Required. A value indicating whether this is the primary NIC. - :type is_primary_nic: str - :param target_subnet_name: Target subnet name. - :type target_subnet_name: str - :param target_static_ip_address: The static IP address. - :type target_static_ip_address: str - :param is_selected_for_migration: A value indicating whether this NIC is selected for - migration. - :type is_selected_for_migration: str - :param target_nic_name: Target NIC name. - :type target_nic_name: str - """ - - _validation = { - 'nic_id': {'required': True}, - 'is_primary_nic': {'required': True}, - } - - _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'is_primary_nic': {'key': 'isPrimaryNic', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'target_static_ip_address': {'key': 'targetStaticIPAddress', 'type': 'str'}, - 'is_selected_for_migration': {'key': 'isSelectedForMigration', 'type': 'str'}, - 'target_nic_name': {'key': 'targetNicName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtNicInput, self).__init__(**kwargs) - self.nic_id = kwargs['nic_id'] - self.is_primary_nic = kwargs['is_primary_nic'] - self.target_subnet_name = kwargs.get('target_subnet_name', None) - self.target_static_ip_address = kwargs.get('target_static_ip_address', None) - self.is_selected_for_migration = kwargs.get('is_selected_for_migration', None) - self.target_nic_name = kwargs.get('target_nic_name', None) - - -class VMwareCbtPolicyCreationInput(PolicyProviderSpecificInput): - """VMware Cbt policy creation input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :type recovery_point_history_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_in_minutes': {'key': 'recoveryPointHistoryInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtPolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.recovery_point_history_in_minutes = kwargs.get('recovery_point_history_in_minutes', None) - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - - -class VmwareCbtPolicyDetails(PolicyProviderSpecificDetails): - """VMware Cbt specific policy details. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :type recovery_point_history_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :type crash_consistent_frequency_in_minutes: int - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_in_minutes': {'key': 'recoveryPointHistoryInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(VmwareCbtPolicyDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.recovery_point_history_in_minutes = kwargs.get('recovery_point_history_in_minutes', None) - self.app_consistent_frequency_in_minutes = kwargs.get('app_consistent_frequency_in_minutes', None) - self.crash_consistent_frequency_in_minutes = kwargs.get('crash_consistent_frequency_in_minutes', None) - - -class VMwareCbtProtectedDiskDetails(msrest.serialization.Model): - """VMwareCbt protected disk details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_id: The disk id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :param disk_type: The disk type. Possible values include: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar disk_path: The disk path. - :vartype disk_path: str - :ivar is_os_disk: A value indicating whether the disk is the OS disk. - :vartype is_os_disk: str - :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: long - :ivar log_storage_account_id: The log storage account ARM Id. - :vartype log_storage_account_id: str - :ivar log_storage_account_sas_secret_name: The key vault secret name of the log storage - account. - :vartype log_storage_account_sas_secret_name: str - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :vartype disk_encryption_set_id: str - :ivar seed_managed_disk_id: The ARM Id of the seed managed disk. - :vartype seed_managed_disk_id: str - :ivar target_managed_disk_id: The ARM Id of the target managed disk. - :vartype target_managed_disk_id: str - :param target_disk_name: The name for the target managed disk. - :type target_disk_name: str - """ - - _validation = { - 'disk_id': {'readonly': True}, - 'disk_name': {'readonly': True}, - 'disk_path': {'readonly': True}, - 'is_os_disk': {'readonly': True}, - 'capacity_in_bytes': {'readonly': True}, - 'log_storage_account_id': {'readonly': True}, - 'log_storage_account_sas_secret_name': {'readonly': True}, - 'disk_encryption_set_id': {'readonly': True}, - 'seed_managed_disk_id': {'readonly': True}, - 'target_managed_disk_id': {'readonly': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_path': {'key': 'diskPath', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'log_storage_account_sas_secret_name': {'key': 'logStorageAccountSasSecretName', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'seed_managed_disk_id': {'key': 'seedManagedDiskId', 'type': 'str'}, - 'target_managed_disk_id': {'key': 'targetManagedDiskId', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtProtectedDiskDetails, self).__init__(**kwargs) - self.disk_id = None - self.disk_name = None - self.disk_type = kwargs.get('disk_type', None) - self.disk_path = None - self.is_os_disk = None - self.capacity_in_bytes = None - self.log_storage_account_id = None - self.log_storage_account_sas_secret_name = None - self.disk_encryption_set_id = None - self.seed_managed_disk_id = None - self.target_managed_disk_id = None - self.target_disk_name = kwargs.get('target_disk_name', None) - - -class VMwareCbtProtectionContainerMappingDetails(ProtectionContainerMappingProviderSpecificDetails): - """VMwareCbt provider specific container mapping details. - - 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. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :ivar key_vault_id: The target key vault ARM Id. - :vartype key_vault_id: str - :ivar key_vault_uri: The target key vault URI. - :vartype key_vault_uri: str - :ivar storage_account_id: The storage account ARM Id. - :vartype storage_account_id: str - :ivar storage_account_sas_secret_name: The secret name of the storage account. - :vartype storage_account_sas_secret_name: str - :ivar service_bus_connection_string_secret_name: The secret name of the service bus connection - string. - :vartype service_bus_connection_string_secret_name: str - :ivar target_location: The target location. - :vartype target_location: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'key_vault_id': {'readonly': True}, - 'key_vault_uri': {'readonly': True}, - 'storage_account_id': {'readonly': True}, - 'storage_account_sas_secret_name': {'readonly': True}, - 'service_bus_connection_string_secret_name': {'readonly': True}, - 'target_location': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'storage_account_sas_secret_name': {'key': 'storageAccountSasSecretName', 'type': 'str'}, - 'service_bus_connection_string_secret_name': {'key': 'serviceBusConnectionStringSecretName', 'type': 'str'}, - 'target_location': {'key': 'targetLocation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtProtectionContainerMappingDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.key_vault_id = None - self.key_vault_uri = None - self.storage_account_id = None - self.storage_account_sas_secret_name = None - self.service_bus_connection_string_secret_name = None - self.target_location = None - - -class VMwareCbtResyncInput(ResyncProviderSpecificInput): - """VMwareCbt specific resync input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param skip_cbt_reset: Required. A value indicating whether CBT is to be reset. - :type skip_cbt_reset: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'skip_cbt_reset': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'skip_cbt_reset': {'key': 'skipCbtReset', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtResyncInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.skip_cbt_reset = kwargs['skip_cbt_reset'] - - -class VMwareCbtTestMigrateInput(TestMigrateProviderSpecificInput): - """VMwareCbt specific test migrate input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: Required. The recovery point Id. - :type recovery_point_id: str - :param network_id: Required. The test network Id. - :type network_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_point_id': {'required': True}, - 'network_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'network_id': {'key': 'networkId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtTestMigrateInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.recovery_point_id = kwargs['recovery_point_id'] - self.network_id = kwargs['network_id'] - - -class VMwareCbtUpdateDiskInput(msrest.serialization.Model): - """VMwareCbt disk input for update. - - All required parameters must be populated in order to send to Azure. - - :param disk_id: Required. The disk Id. - :type disk_id: str - :param target_disk_name: The target disk name. - :type target_disk_name: str - """ - - _validation = { - 'disk_id': {'required': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtUpdateDiskInput, self).__init__(**kwargs) - self.disk_id = kwargs['disk_id'] - self.target_disk_name = kwargs.get('target_disk_name', None) - - -class VMwareCbtUpdateMigrationItemInput(UpdateMigrationItemProviderSpecificInput): - """VMwareCbt specific update migration item input. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param target_vm_name: The target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_resource_group_id: The target resource group ARM Id. - :type target_resource_group_id: str - :param target_availability_set_id: The target availability set ARM Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group ARM Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param target_network_id: The target network ARM Id. - :type target_network_id: str - :param vm_nics: The list of NIC details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] - :param vm_disks: The list of disk update properties. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput] - :param license_type: The license type. Possible values include: "NotSpecified", - "NoLicenseType", "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param perform_auto_resync: A value indicating whether auto resync is to be done. - :type perform_auto_resync: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param target_disk_tags: The tags for the target disks. - :type target_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMwareCbtNicInput]'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[VMwareCbtUpdateDiskInput]'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'perform_auto_resync': {'key': 'performAutoResync', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'target_disk_tags': {'key': 'targetDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareCbtUpdateMigrationItemInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str - self.target_vm_name = kwargs.get('target_vm_name', None) - self.target_vm_size = kwargs.get('target_vm_size', None) - self.target_resource_group_id = kwargs.get('target_resource_group_id', None) - self.target_availability_set_id = kwargs.get('target_availability_set_id', None) - self.target_availability_zone = kwargs.get('target_availability_zone', None) - self.target_proximity_placement_group_id = kwargs.get('target_proximity_placement_group_id', None) - self.target_boot_diagnostics_storage_account_id = kwargs.get('target_boot_diagnostics_storage_account_id', None) - self.target_network_id = kwargs.get('target_network_id', None) - self.vm_nics = kwargs.get('vm_nics', None) - self.vm_disks = kwargs.get('vm_disks', None) - self.license_type = kwargs.get('license_type', None) - self.sql_server_license_type = kwargs.get('sql_server_license_type', None) - self.perform_auto_resync = kwargs.get('perform_auto_resync', None) - self.target_vm_tags = kwargs.get('target_vm_tags', None) - self.target_disk_tags = kwargs.get('target_disk_tags', None) - self.target_nic_tags = kwargs.get('target_nic_tags', None) - - -class VMwareDetails(FabricSpecificDetails): - """Store the fabric details specific to the VMware fabric. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param process_servers: The list of Process Servers associated with the fabric. - :type process_servers: list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServer] - :param master_target_servers: The list of Master Target servers associated with the fabric. - :type master_target_servers: - list[~azure.mgmt.recoveryservicessiterecovery.models.MasterTargetServer] - :param run_as_accounts: The list of run as accounts created on the server. - :type run_as_accounts: list[~azure.mgmt.recoveryservicessiterecovery.models.RunAsAccount] - :param replication_pair_count: The number of replication pairs configured in this CS. - :type replication_pair_count: str - :param process_server_count: The number of process servers. - :type process_server_count: str - :param agent_count: The number of source and target servers configured to talk to this CS. - :type agent_count: str - :param protected_servers: The number of protected servers. - :type protected_servers: str - :param system_load: The percentage of the system load. - :type system_load: str - :param system_load_status: The system load status. - :type system_load_status: str - :param cpu_load: The percentage of the CPU load. - :type cpu_load: str - :param cpu_load_status: The CPU load status. - :type cpu_load_status: str - :param total_memory_in_bytes: The total memory. - :type total_memory_in_bytes: long - :param available_memory_in_bytes: The available memory. - :type available_memory_in_bytes: long - :param memory_usage_status: The memory usage status. - :type memory_usage_status: str - :param total_space_in_bytes: The total space. - :type total_space_in_bytes: long - :param available_space_in_bytes: The available space. - :type available_space_in_bytes: long - :param space_usage_status: The space usage status. - :type space_usage_status: str - :param web_load: The web load. - :type web_load: str - :param web_load_status: The web load status. - :type web_load_status: str - :param database_server_load: The database server load. - :type database_server_load: str - :param database_server_load_status: The database server load status. - :type database_server_load_status: str - :param cs_service_status: The CS service status. - :type cs_service_status: str - :param ip_address: The IP address. - :type ip_address: str - :param agent_version: The agent Version. - :type agent_version: str - :param host_name: The host name. - :type host_name: str - :param last_heartbeat: The last heartbeat received from CS server. - :type last_heartbeat: ~datetime.datetime - :param version_status: Version status. - :type version_status: str - :param ssl_cert_expiry_date: CS SSL cert expiry date. - :type ssl_cert_expiry_date: ~datetime.datetime - :param ssl_cert_expiry_remaining_days: CS SSL cert expiry date. - :type ssl_cert_expiry_remaining_days: int - :param ps_template_version: PS template version. - :type ps_template_version: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param agent_version_details: The agent version details. - :type agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'process_servers': {'key': 'processServers', 'type': '[ProcessServer]'}, - 'master_target_servers': {'key': 'masterTargetServers', 'type': '[MasterTargetServer]'}, - 'run_as_accounts': {'key': 'runAsAccounts', 'type': '[RunAsAccount]'}, - 'replication_pair_count': {'key': 'replicationPairCount', 'type': 'str'}, - 'process_server_count': {'key': 'processServerCount', 'type': 'str'}, - 'agent_count': {'key': 'agentCount', 'type': 'str'}, - 'protected_servers': {'key': 'protectedServers', 'type': 'str'}, - 'system_load': {'key': 'systemLoad', 'type': 'str'}, - 'system_load_status': {'key': 'systemLoadStatus', 'type': 'str'}, - 'cpu_load': {'key': 'cpuLoad', 'type': 'str'}, - 'cpu_load_status': {'key': 'cpuLoadStatus', 'type': 'str'}, - 'total_memory_in_bytes': {'key': 'totalMemoryInBytes', 'type': 'long'}, - 'available_memory_in_bytes': {'key': 'availableMemoryInBytes', 'type': 'long'}, - 'memory_usage_status': {'key': 'memoryUsageStatus', 'type': 'str'}, - 'total_space_in_bytes': {'key': 'totalSpaceInBytes', 'type': 'long'}, - 'available_space_in_bytes': {'key': 'availableSpaceInBytes', 'type': 'long'}, - 'space_usage_status': {'key': 'spaceUsageStatus', 'type': 'str'}, - 'web_load': {'key': 'webLoad', 'type': 'str'}, - 'web_load_status': {'key': 'webLoadStatus', 'type': 'str'}, - 'database_server_load': {'key': 'databaseServerLoad', 'type': 'str'}, - 'database_server_load_status': {'key': 'databaseServerLoadStatus', 'type': 'str'}, - 'cs_service_status': {'key': 'csServiceStatus', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'version_status': {'key': 'versionStatus', 'type': 'str'}, - 'ssl_cert_expiry_date': {'key': 'sslCertExpiryDate', 'type': 'iso-8601'}, - 'ssl_cert_expiry_remaining_days': {'key': 'sslCertExpiryRemainingDays', 'type': 'int'}, - 'ps_template_version': {'key': 'psTemplateVersion', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'agent_version_details': {'key': 'agentVersionDetails', 'type': 'VersionDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareDetails, self).__init__(**kwargs) - self.instance_type = 'VMware' # type: str - self.process_servers = kwargs.get('process_servers', None) - self.master_target_servers = kwargs.get('master_target_servers', None) - self.run_as_accounts = kwargs.get('run_as_accounts', None) - self.replication_pair_count = kwargs.get('replication_pair_count', None) - self.process_server_count = kwargs.get('process_server_count', None) - self.agent_count = kwargs.get('agent_count', None) - self.protected_servers = kwargs.get('protected_servers', None) - self.system_load = kwargs.get('system_load', None) - self.system_load_status = kwargs.get('system_load_status', None) - self.cpu_load = kwargs.get('cpu_load', None) - self.cpu_load_status = kwargs.get('cpu_load_status', None) - self.total_memory_in_bytes = kwargs.get('total_memory_in_bytes', None) - self.available_memory_in_bytes = kwargs.get('available_memory_in_bytes', None) - self.memory_usage_status = kwargs.get('memory_usage_status', None) - self.total_space_in_bytes = kwargs.get('total_space_in_bytes', None) - self.available_space_in_bytes = kwargs.get('available_space_in_bytes', None) - self.space_usage_status = kwargs.get('space_usage_status', None) - self.web_load = kwargs.get('web_load', None) - self.web_load_status = kwargs.get('web_load_status', None) - self.database_server_load = kwargs.get('database_server_load', None) - self.database_server_load_status = kwargs.get('database_server_load_status', None) - self.cs_service_status = kwargs.get('cs_service_status', None) - self.ip_address = kwargs.get('ip_address', None) - self.agent_version = kwargs.get('agent_version', None) - self.host_name = kwargs.get('host_name', None) - self.last_heartbeat = kwargs.get('last_heartbeat', None) - self.version_status = kwargs.get('version_status', None) - self.ssl_cert_expiry_date = kwargs.get('ssl_cert_expiry_date', None) - self.ssl_cert_expiry_remaining_days = kwargs.get('ssl_cert_expiry_remaining_days', None) - self.ps_template_version = kwargs.get('ps_template_version', None) - self.agent_expiry_date = kwargs.get('agent_expiry_date', None) - self.agent_version_details = kwargs.get('agent_version_details', None) - - -class VMwareV2FabricCreationInput(FabricSpecificCreationInput): - """VMwareV2 fabric provider specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type.Constant filled by server. - :type instance_type: str - :param vmware_site_id: The ARM Id of the VMware site. - :type vmware_site_id: str - :param physical_site_id: The ARM Id of the physical site. - :type physical_site_id: str - :param migration_solution_id: Required. The ARM Id of the migration solution. - :type migration_solution_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'migration_solution_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_site_id': {'key': 'vmwareSiteId', 'type': 'str'}, - 'physical_site_id': {'key': 'physicalSiteId', 'type': 'str'}, - 'migration_solution_id': {'key': 'migrationSolutionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareV2FabricCreationInput, self).__init__(**kwargs) - self.instance_type = 'VMwareV2' # type: str - self.vmware_site_id = kwargs.get('vmware_site_id', None) - self.physical_site_id = kwargs.get('physical_site_id', None) - self.migration_solution_id = kwargs['migration_solution_id'] - - -class VMwareV2FabricSpecificDetails(FabricSpecificDetails): - """VMwareV2 fabric specific details. - - 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. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :ivar vmware_site_id: The ARM Id of the VMware site. - :vartype vmware_site_id: str - :ivar physical_site_id: The ARM Id of the physical site. - :vartype physical_site_id: str - :ivar migration_solution_id: The Migration solution ARM Id. - :vartype migration_solution_id: str - :ivar service_endpoint: The service endpoint. - :vartype service_endpoint: str - :ivar service_resource_id: The service resource Id. - :vartype service_resource_id: str - :ivar service_container_id: The service container Id. - :vartype service_container_id: str - :ivar process_servers: The list of process servers. - :vartype process_servers: - list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails] - """ - - _validation = { - 'instance_type': {'required': True}, - 'vmware_site_id': {'readonly': True}, - 'physical_site_id': {'readonly': True}, - 'migration_solution_id': {'readonly': True}, - 'service_endpoint': {'readonly': True}, - 'service_resource_id': {'readonly': True}, - 'service_container_id': {'readonly': True}, - 'process_servers': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_site_id': {'key': 'vmwareSiteId', 'type': 'str'}, - 'physical_site_id': {'key': 'physicalSiteId', 'type': 'str'}, - 'migration_solution_id': {'key': 'migrationSolutionId', 'type': 'str'}, - 'service_endpoint': {'key': 'serviceEndpoint', 'type': 'str'}, - 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, - 'service_container_id': {'key': 'serviceContainerId', 'type': 'str'}, - 'process_servers': {'key': 'processServers', 'type': '[ProcessServerDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareV2FabricSpecificDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareV2' # type: str - self.vmware_site_id = None - self.physical_site_id = None - self.migration_solution_id = None - self.service_endpoint = None - self.service_resource_id = None - self.service_container_id = None - self.process_servers = None - - -class VMwareVirtualMachineDetails(ConfigurationSettings): - """VMware provider specific settings. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param agent_generated_id: The ID generated by the InMage agent after it gets installed on - guest. This is the ID to be used during InMage CreateProtection. - :type agent_generated_id: str - :param agent_installed: The value indicating if InMage scout agent is installed on guest. - :type agent_installed: str - :param os_type: The OsType installed on VM. - :type os_type: str - :param agent_version: The agent version. - :type agent_version: str - :param ip_address: The IP address. - :type ip_address: str - :param powered_on: The value indicating whether VM is powered on. - :type powered_on: str - :param v_center_infrastructure_id: The VCenter infrastructure Id. - :type v_center_infrastructure_id: str - :param discovery_type: A value indicating the discovery type of the machine. Value can be - vCenter or physical. - :type discovery_type: str - :param disk_details: The disk details. - :type disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskDetails] - :param validation_errors: The validation errors. - :type validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'agent_generated_id': {'key': 'agentGeneratedId', 'type': 'str'}, - 'agent_installed': {'key': 'agentInstalled', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'powered_on': {'key': 'poweredOn', 'type': 'str'}, - 'v_center_infrastructure_id': {'key': 'vCenterInfrastructureId', 'type': 'str'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'disk_details': {'key': 'diskDetails', 'type': '[InMageDiskDetails]'}, - 'validation_errors': {'key': 'validationErrors', 'type': '[HealthError]'}, - } - - def __init__( - self, - **kwargs - ): - super(VMwareVirtualMachineDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareVirtualMachine' # type: str - self.agent_generated_id = kwargs.get('agent_generated_id', None) - self.agent_installed = kwargs.get('agent_installed', None) - self.os_type = kwargs.get('os_type', None) - self.agent_version = kwargs.get('agent_version', None) - self.ip_address = kwargs.get('ip_address', None) - self.powered_on = kwargs.get('powered_on', None) - self.v_center_infrastructure_id = kwargs.get('v_center_infrastructure_id', None) - self.discovery_type = kwargs.get('discovery_type', None) - self.disk_details = kwargs.get('disk_details', None) - self.validation_errors = kwargs.get('validation_errors', None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py index 2c995b47ac33..67f85b37e72f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,42 +8,46 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from .. import _serialization -from ._site_recovery_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -class AddDisksProviderSpecificInput(msrest.serialization.Model): +class AddDisksProviderSpecificInput(_serialization.Model): """Add Disks provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AAddDisksInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AAddDisksInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'A2A': 'A2AAddDisksInput'} - } + _subtype_map = {"instance_type": {"A2A": "A2AAddDisksInput"}} - def __init__( - self, - **kwargs - ): - super(AddDisksProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -51,67 +56,81 @@ class A2AAddDisksInput(AddDisksProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param vm_disks: The list of vm disk details. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk details. - :type vm_managed_disks: + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :ivar vm_managed_disks: The list of vm managed disk details. + :vartype vm_managed_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AVmDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AVmManagedDiskInputDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "vm_disks": {"key": "vmDisks", "type": "[A2AVmDiskInputDetails]"}, + "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AVmManagedDiskInputDetails]"}, } def __init__( self, *, - vm_disks: Optional[List["A2AVmDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["A2AVmManagedDiskInputDetails"]] = None, + vm_disks: Optional[List["_models.A2AVmDiskInputDetails"]] = None, + vm_managed_disks: Optional[List["_models.A2AVmManagedDiskInputDetails"]] = None, **kwargs ): - super(A2AAddDisksInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword vm_disks: The list of vm disk details. + :paramtype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :keyword vm_managed_disks: The list of vm managed disk details. + :paramtype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.vm_disks = vm_disks self.vm_managed_disks = vm_managed_disks -class ApplyRecoveryPointProviderSpecificInput(msrest.serialization.Model): +class ApplyRecoveryPointProviderSpecificInput(_serialization.Model): """Provider specific input for apply recovery point. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AApplyRecoveryPointInput, A2ACrossClusterMigrationApplyRecoveryPointInput, HyperVReplicaAzureApplyRecoveryPointInput, InMageAzureV2ApplyRecoveryPointInput, InMageRcmApplyRecoveryPointInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AApplyRecoveryPointInput, A2ACrossClusterMigrationApplyRecoveryPointInput, + HyperVReplicaAzureApplyRecoveryPointInput, InMageAzureV2ApplyRecoveryPointInput, + InMageRcmApplyRecoveryPointInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AApplyRecoveryPointInput', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationApplyRecoveryPointInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureApplyRecoveryPointInput', 'InMageAzureV2': 'InMageAzureV2ApplyRecoveryPointInput', 'InMageRcm': 'InMageRcmApplyRecoveryPointInput'} - } - - def __init__( - self, - **kwargs - ): - super(ApplyRecoveryPointProviderSpecificInput, self).__init__(**kwargs) + "instance_type": { + "A2A": "A2AApplyRecoveryPointInput", + "A2ACrossClusterMigration": "A2ACrossClusterMigrationApplyRecoveryPointInput", + "HyperVReplicaAzure": "HyperVReplicaAzureApplyRecoveryPointInput", + "InMageAzureV2": "InMageAzureV2ApplyRecoveryPointInput", + "InMageRcm": "InMageRcmApplyRecoveryPointInput", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -120,55 +139,56 @@ class A2AApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(A2AApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str -class ReplicationProviderSpecificContainerCreationInput(msrest.serialization.Model): +class ReplicationProviderSpecificContainerCreationInput(_serialization.Model): """Provider specific input for container creation operation. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AContainerCreationInput, A2ACrossClusterMigrationContainerCreationInput, VMwareCbtContainerCreationInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AContainerCreationInput, A2ACrossClusterMigrationContainerCreationInput, + VMwareCbtContainerCreationInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AContainerCreationInput', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationContainerCreationInput', 'VMwareCbt': 'VMwareCbtContainerCreationInput'} + "instance_type": { + "A2A": "A2AContainerCreationInput", + "A2ACrossClusterMigration": "A2ACrossClusterMigrationContainerCreationInput", + "VMwareCbt": "VMwareCbtContainerCreationInput", + } } - def __init__( - self, - **kwargs - ): - super(ReplicationProviderSpecificContainerCreationInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -177,55 +197,49 @@ class A2AContainerCreationInput(ReplicationProviderSpecificContainerCreationInpu All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(A2AContainerCreationInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str -class ReplicationProviderSpecificContainerMappingInput(msrest.serialization.Model): +class ReplicationProviderSpecificContainerMappingInput(_serialization.Model): """Provider specific input for pairing operations. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AContainerMappingInput, VMwareCbtContainerMappingInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AContainerMappingInput, VMwareCbtContainerMappingInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'A2A': 'A2AContainerMappingInput', 'VMwareCbt': 'VMwareCbtContainerMappingInput'} - } + _subtype_map = {"instance_type": {"A2A": "A2AContainerMappingInput", "VMwareCbt": "VMwareCbtContainerMappingInput"}} - def __init__( - self, - **kwargs - ): - super(ReplicationProviderSpecificContainerMappingInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -234,163 +248,215 @@ class A2AContainerMappingInput(ReplicationProviderSpecificContainerMappingInput) All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param agent_auto_update_status: A value indicating whether the auto update is enabled. - Possible values include: "Disabled", "Enabled". - :type agent_auto_update_status: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :param automation_account_arm_id: The automation account arm id. - :type automation_account_arm_id: str + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + :ivar automation_account_authentication_type: A value indicating the type authentication to use + for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'agent_auto_update_status': {'key': 'agentAutoUpdateStatus', 'type': 'str'}, - 'automation_account_arm_id': {'key': 'automationAccountArmId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, + "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, + "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, } def __init__( self, *, - agent_auto_update_status: Optional[Union[str, "AgentAutoUpdateStatus"]] = None, + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, automation_account_arm_id: Optional[str] = None, - **kwargs - ): - super(A2AContainerMappingInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = None, + **kwargs + ): + """ + :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :paramtype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :keyword automation_account_arm_id: The automation account arm id. + :paramtype automation_account_arm_id: str + :keyword automation_account_authentication_type: A value indicating the type authentication to + use for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :paramtype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.agent_auto_update_status = agent_auto_update_status self.automation_account_arm_id = automation_account_arm_id + self.automation_account_authentication_type = automation_account_authentication_type -class CreateProtectionIntentProviderSpecificDetails(msrest.serialization.Model): +class CreateProtectionIntentProviderSpecificDetails(_serialization.Model): """Create protection intent provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ACreateProtectionIntentInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ACreateProtectionIntentInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'A2A': 'A2ACreateProtectionIntentInput'} - } + _subtype_map = {"instance_type": {"A2A": "A2ACreateProtectionIntentInput"}} - def __init__( - self, - **kwargs - ): - super(CreateProtectionIntentProviderSpecificDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class A2ACreateProtectionIntentInput(CreateProtectionIntentProviderSpecificDetails): +class A2ACreateProtectionIntentInput( + CreateProtectionIntentProviderSpecificDetails +): # pylint: disable=too-many-instance-attributes """A2A create protection intent input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: Required. The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param primary_location: Required. The primary location for the virtual machine. - :type primary_location: str - :param recovery_location: Required. The recovery location for the virtual machine. - :type recovery_location: str - :param recovery_subscription_id: Required. The recovery subscription Id of the virtual machine. - :type recovery_subscription_id: str - :param recovery_availability_type: Required. The recovery availability type of the virtual - machine. Possible values include: "Single", "AvailabilitySet", "AvailabilityZone". - :type recovery_availability_type: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. Required. + :vartype fabric_object_id: str + :ivar primary_location: The primary location for the virtual machine. Required. + :vartype primary_location: str + :ivar recovery_location: The recovery location for the virtual machine. Required. + :vartype recovery_location: str + :ivar recovery_subscription_id: The recovery subscription Id of the virtual machine. Required. + :vartype recovery_subscription_id: str + :ivar recovery_availability_type: The recovery availability type of the virtual machine. + Required. Known values are: "Single", "AvailabilitySet", and "AvailabilityZone". + :vartype recovery_availability_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.A2ARecoveryAvailabilityType - :param protection_profile_custom_input: The protection profile custom inputs. - :type protection_profile_custom_input: + :ivar protection_profile_custom_input: The protection profile custom inputs. + :vartype protection_profile_custom_input: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails - :param recovery_resource_group_id: Required. The recovery resource group Id. Valid for V2 - scenarios. - :type recovery_resource_group_id: str - :param primary_staging_storage_account_custom_input: The primary staging storage account input. - :type primary_staging_storage_account_custom_input: + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + Required. + :vartype recovery_resource_group_id: str + :ivar primary_staging_storage_account_custom_input: The primary staging storage account input. + :vartype primary_staging_storage_account_custom_input: ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param recovery_availability_set_custom_input: The recovery availability set input. - :type recovery_availability_set_custom_input: + :ivar recovery_availability_set_custom_input: The recovery availability set input. + :vartype recovery_availability_set_custom_input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails - :param recovery_virtual_network_custom_input: The recovery virtual network input. - :type recovery_virtual_network_custom_input: + :ivar recovery_virtual_network_custom_input: The recovery virtual network input. + :vartype recovery_virtual_network_custom_input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails - :param recovery_proximity_placement_group_custom_input: The recovery proximity placement group + :ivar recovery_proximity_placement_group_custom_input: The recovery proximity placement group custom input. - :type recovery_proximity_placement_group_custom_input: + :vartype recovery_proximity_placement_group_custom_input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails - :param auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Possible values include: "Disabled", "Enabled". - :type auto_protection_of_data_disk: str or + :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. + Known values are: "Disabled" and "Enabled". + :vartype auto_protection_of_data_disk: str or ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :param vm_disks: The list of vm disk inputs. - :type vm_disks: + :ivar vm_disks: The list of vm disk inputs. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk inputs. - :type vm_managed_disks: + :ivar vm_managed_disks: The list of vm managed disk inputs. + :vartype vm_managed_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_group_id: The multi vm group id. - :type multi_vm_group_id: str - :param recovery_boot_diag_storage_account: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account: + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_group_id: The multi vm group id. + :vartype multi_vm_group_id: str + :ivar recovery_boot_diag_storage_account: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account: ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param disk_encryption_info: The recovery disk encryption information (for two pass flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'fabric_object_id': {'required': True}, - 'primary_location': {'required': True}, - 'recovery_location': {'required': True}, - 'recovery_subscription_id': {'required': True}, - 'recovery_availability_type': {'required': True}, - 'recovery_resource_group_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'primary_location': {'key': 'primaryLocation', 'type': 'str'}, - 'recovery_location': {'key': 'recoveryLocation', 'type': 'str'}, - 'recovery_subscription_id': {'key': 'recoverySubscriptionId', 'type': 'str'}, - 'recovery_availability_type': {'key': 'recoveryAvailabilityType', 'type': 'str'}, - 'protection_profile_custom_input': {'key': 'protectionProfileCustomInput', 'type': 'ProtectionProfileCustomDetails'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'primary_staging_storage_account_custom_input': {'key': 'primaryStagingStorageAccountCustomInput', 'type': 'StorageAccountCustomDetails'}, - 'recovery_availability_set_custom_input': {'key': 'recoveryAvailabilitySetCustomInput', 'type': 'RecoveryAvailabilitySetCustomDetails'}, - 'recovery_virtual_network_custom_input': {'key': 'recoveryVirtualNetworkCustomInput', 'type': 'RecoveryVirtualNetworkCustomDetails'}, - 'recovery_proximity_placement_group_custom_input': {'key': 'recoveryProximityPlacementGroupCustomInput', 'type': 'RecoveryProximityPlacementGroupCustomDetails'}, - 'auto_protection_of_data_disk': {'key': 'autoProtectionOfDataDisk', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AProtectionIntentDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AProtectionIntentManagedDiskInputDetails]'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'recovery_boot_diag_storage_account': {'key': 'recoveryBootDiagStorageAccount', 'type': 'StorageAccountCustomDetails'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, + :ivar disk_encryption_info: The recovery disk encryption information (for two pass flows). + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :ivar automation_account_authentication_type: A value indicating the authentication type for + automation account. The default value is "RunAsAccount". Known values are: "RunAsAccount" and + "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + """ + + _validation = { + "instance_type": {"required": True}, + "fabric_object_id": {"required": True}, + "primary_location": {"required": True}, + "recovery_location": {"required": True}, + "recovery_subscription_id": {"required": True}, + "recovery_availability_type": {"required": True}, + "recovery_resource_group_id": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "primary_location": {"key": "primaryLocation", "type": "str"}, + "recovery_location": {"key": "recoveryLocation", "type": "str"}, + "recovery_subscription_id": {"key": "recoverySubscriptionId", "type": "str"}, + "recovery_availability_type": {"key": "recoveryAvailabilityType", "type": "str"}, + "protection_profile_custom_input": { + "key": "protectionProfileCustomInput", + "type": "ProtectionProfileCustomDetails", + }, + "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, + "primary_staging_storage_account_custom_input": { + "key": "primaryStagingStorageAccountCustomInput", + "type": "StorageAccountCustomDetails", + }, + "recovery_availability_set_custom_input": { + "key": "recoveryAvailabilitySetCustomInput", + "type": "RecoveryAvailabilitySetCustomDetails", + }, + "recovery_virtual_network_custom_input": { + "key": "recoveryVirtualNetworkCustomInput", + "type": "RecoveryVirtualNetworkCustomDetails", + }, + "recovery_proximity_placement_group_custom_input": { + "key": "recoveryProximityPlacementGroupCustomInput", + "type": "RecoveryProximityPlacementGroupCustomDetails", + }, + "auto_protection_of_data_disk": {"key": "autoProtectionOfDataDisk", "type": "str"}, + "vm_disks": {"key": "vmDisks", "type": "[A2AProtectionIntentDiskInputDetails]"}, + "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AProtectionIntentManagedDiskInputDetails]"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, + "recovery_boot_diag_storage_account": { + "key": "recoveryBootDiagStorageAccount", + "type": "StorageAccountCustomDetails", + }, + "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, + "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, + "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, + "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, + "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, } def __init__( @@ -400,25 +466,100 @@ def __init__( primary_location: str, recovery_location: str, recovery_subscription_id: str, - recovery_availability_type: Union[str, "A2ARecoveryAvailabilityType"], + recovery_availability_type: Union[str, "_models.A2ARecoveryAvailabilityType"], recovery_resource_group_id: str, - protection_profile_custom_input: Optional["ProtectionProfileCustomDetails"] = None, - primary_staging_storage_account_custom_input: Optional["StorageAccountCustomDetails"] = None, - recovery_availability_set_custom_input: Optional["RecoveryAvailabilitySetCustomDetails"] = None, - recovery_virtual_network_custom_input: Optional["RecoveryVirtualNetworkCustomDetails"] = None, - recovery_proximity_placement_group_custom_input: Optional["RecoveryProximityPlacementGroupCustomDetails"] = None, - auto_protection_of_data_disk: Optional[Union[str, "AutoProtectionOfDataDisk"]] = None, - vm_disks: Optional[List["A2AProtectionIntentDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["A2AProtectionIntentManagedDiskInputDetails"]] = None, + protection_profile_custom_input: Optional["_models.ProtectionProfileCustomDetails"] = None, + primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, + recovery_availability_set_custom_input: Optional["_models.RecoveryAvailabilitySetCustomDetails"] = None, + recovery_virtual_network_custom_input: Optional["_models.RecoveryVirtualNetworkCustomDetails"] = None, + recovery_proximity_placement_group_custom_input: Optional[ + "_models.RecoveryProximityPlacementGroupCustomDetails" + ] = None, + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, + vm_disks: Optional[List["_models.A2AProtectionIntentDiskInputDetails"]] = None, + vm_managed_disks: Optional[List["_models.A2AProtectionIntentManagedDiskInputDetails"]] = None, multi_vm_group_name: Optional[str] = None, multi_vm_group_id: Optional[str] = None, - recovery_boot_diag_storage_account: Optional["StorageAccountCustomDetails"] = None, - disk_encryption_info: Optional["DiskEncryptionInfo"] = None, + recovery_boot_diag_storage_account: Optional["_models.StorageAccountCustomDetails"] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, recovery_availability_zone: Optional[str] = None, + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = None, + automation_account_arm_id: Optional[str] = None, **kwargs ): - super(A2ACreateProtectionIntentInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword fabric_object_id: The fabric specific object Id of the virtual machine. Required. + :paramtype fabric_object_id: str + :keyword primary_location: The primary location for the virtual machine. Required. + :paramtype primary_location: str + :keyword recovery_location: The recovery location for the virtual machine. Required. + :paramtype recovery_location: str + :keyword recovery_subscription_id: The recovery subscription Id of the virtual machine. + Required. + :paramtype recovery_subscription_id: str + :keyword recovery_availability_type: The recovery availability type of the virtual machine. + Required. Known values are: "Single", "AvailabilitySet", and "AvailabilityZone". + :paramtype recovery_availability_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.A2ARecoveryAvailabilityType + :keyword protection_profile_custom_input: The protection profile custom inputs. + :paramtype protection_profile_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails + :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + Required. + :paramtype recovery_resource_group_id: str + :keyword primary_staging_storage_account_custom_input: The primary staging storage account + input. + :paramtype primary_staging_storage_account_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :keyword recovery_availability_set_custom_input: The recovery availability set input. + :paramtype recovery_availability_set_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails + :keyword recovery_virtual_network_custom_input: The recovery virtual network input. + :paramtype recovery_virtual_network_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails + :keyword recovery_proximity_placement_group_custom_input: The recovery proximity placement + group custom input. + :paramtype recovery_proximity_placement_group_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails + :keyword auto_protection_of_data_disk: A value indicating whether the auto protection is + enabled. Known values are: "Disabled" and "Enabled". + :paramtype auto_protection_of_data_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk + :keyword vm_disks: The list of vm disk inputs. + :paramtype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] + :keyword vm_managed_disks: The list of vm managed disk inputs. + :paramtype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] + :keyword multi_vm_group_name: The multi vm group name. + :paramtype multi_vm_group_name: str + :keyword multi_vm_group_id: The multi vm group id. + :paramtype multi_vm_group_id: str + :keyword recovery_boot_diag_storage_account: The boot diagnostic storage account. + :paramtype recovery_boot_diag_storage_account: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :keyword disk_encryption_info: The recovery disk encryption information (for two pass flows). + :paramtype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :keyword recovery_availability_zone: The recovery availability zone. + :paramtype recovery_availability_zone: str + :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :paramtype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :keyword automation_account_authentication_type: A value indicating the authentication type for + automation account. The default value is "RunAsAccount". Known values are: "RunAsAccount" and + "SystemAssignedIdentity". + :paramtype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + :keyword automation_account_arm_id: The automation account arm id. + :paramtype automation_account_arm_id: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.fabric_object_id = fabric_object_id self.primary_location = primary_location self.recovery_location = recovery_location @@ -438,6 +579,9 @@ def __init__( self.recovery_boot_diag_storage_account = recovery_boot_diag_storage_account self.disk_encryption_info = disk_encryption_info self.recovery_availability_zone = recovery_availability_zone + self.agent_auto_update_status = agent_auto_update_status + self.automation_account_authentication_type = automation_account_authentication_type + self.automation_account_arm_id = automation_account_arm_id class A2ACrossClusterMigrationApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): @@ -445,24 +589,22 @@ class A2ACrossClusterMigrationApplyRecoveryPointInput(ApplyRecoveryPointProvider All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(A2ACrossClusterMigrationApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "A2ACrossClusterMigration" # type: str class A2ACrossClusterMigrationContainerCreationInput(ReplicationProviderSpecificContainerCreationInput): @@ -470,55 +612,60 @@ class A2ACrossClusterMigrationContainerCreationInput(ReplicationProviderSpecific All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(A2ACrossClusterMigrationContainerCreationInput, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "A2ACrossClusterMigration" # type: str -class EnableProtectionProviderSpecificInput(msrest.serialization.Model): +class EnableProtectionProviderSpecificInput(_serialization.Model): """Enable protection provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AEnableProtectionInput, A2ACrossClusterMigrationEnableProtectionInput, HyperVReplicaAzureEnableProtectionInput, InMageEnableProtectionInput, InMageAzureV2EnableProtectionInput, InMageRcmEnableProtectionInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AEnableProtectionInput, A2ACrossClusterMigrationEnableProtectionInput, + HyperVReplicaAzureEnableProtectionInput, InMageEnableProtectionInput, + InMageAzureV2EnableProtectionInput, InMageRcmEnableProtectionInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AEnableProtectionInput', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationEnableProtectionInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureEnableProtectionInput', 'InMage': 'InMageEnableProtectionInput', 'InMageAzureV2': 'InMageAzureV2EnableProtectionInput', 'InMageRcm': 'InMageRcmEnableProtectionInput'} - } - - def __init__( - self, - **kwargs - ): - super(EnableProtectionProviderSpecificInput, self).__init__(**kwargs) + "instance_type": { + "A2A": "A2AEnableProtectionInput", + "A2ACrossClusterMigration": "A2ACrossClusterMigrationEnableProtectionInput", + "HyperVReplicaAzure": "HyperVReplicaAzureEnableProtectionInput", + "InMage": "InMageEnableProtectionInput", + "InMageAzureV2": "InMageAzureV2EnableProtectionInput", + "InMageRcm": "InMageRcmEnableProtectionInput", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -527,66 +674,79 @@ class A2ACrossClusterMigrationEnableProtectionInput(EnableProtectionProviderSpec All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. + :vartype fabric_object_id: str + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, } def __init__( - self, - *, - fabric_object_id: Optional[str] = None, - recovery_container_id: Optional[str] = None, - **kwargs + self, *, fabric_object_id: Optional[str] = None, recovery_container_id: Optional[str] = None, **kwargs ): - super(A2ACrossClusterMigrationEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str + """ + :keyword fabric_object_id: The fabric specific object Id of the virtual machine. + :paramtype fabric_object_id: str + :keyword recovery_container_id: The recovery container Id. + :paramtype recovery_container_id: str + """ + super().__init__(**kwargs) + self.instance_type = "A2ACrossClusterMigration" # type: str self.fabric_object_id = fabric_object_id self.recovery_container_id = recovery_container_id -class PolicyProviderSpecificInput(msrest.serialization.Model): +class PolicyProviderSpecificInput(_serialization.Model): """Base class for provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2APolicyCreationInput, A2ACrossClusterMigrationPolicyCreationInput, HyperVReplicaPolicyInput, HyperVReplicaAzurePolicyInput, InMagePolicyInput, InMageAzureV2PolicyInput, InMageRcmPolicyCreationInput, InMageRcmFailbackPolicyCreationInput, VMwareCbtPolicyCreationInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2APolicyCreationInput, A2ACrossClusterMigrationPolicyCreationInput, HyperVReplicaPolicyInput, + HyperVReplicaAzurePolicyInput, InMagePolicyInput, InMageAzureV2PolicyInput, + InMageRcmPolicyCreationInput, InMageRcmFailbackPolicyCreationInput, + VMwareCbtPolicyCreationInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2APolicyCreationInput', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationPolicyCreationInput', 'HyperVReplica2012': 'HyperVReplicaPolicyInput', 'HyperVReplicaAzure': 'HyperVReplicaAzurePolicyInput', 'InMage': 'InMagePolicyInput', 'InMageAzureV2': 'InMageAzureV2PolicyInput', 'InMageRcm': 'InMageRcmPolicyCreationInput', 'InMageRcmFailback': 'InMageRcmFailbackPolicyCreationInput', 'VMwareCbt': 'VMwareCbtPolicyCreationInput'} - } - - def __init__( - self, - **kwargs - ): - super(PolicyProviderSpecificInput, self).__init__(**kwargs) + "instance_type": { + "A2A": "A2APolicyCreationInput", + "A2ACrossClusterMigration": "A2ACrossClusterMigrationPolicyCreationInput", + "HyperVReplica2012": "HyperVReplicaPolicyInput", + "HyperVReplicaAzure": "HyperVReplicaAzurePolicyInput", + "InMage": "InMagePolicyInput", + "InMageAzureV2": "InMageAzureV2PolicyInput", + "InMageRcm": "InMageRcmPolicyCreationInput", + "InMageRcmFailback": "InMageRcmFailbackPolicyCreationInput", + "VMwareCbt": "VMwareCbtPolicyCreationInput", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -595,55 +755,66 @@ class A2ACrossClusterMigrationPolicyCreationInput(PolicyProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(A2ACrossClusterMigrationPolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "A2ACrossClusterMigration" # type: str -class ReplicationProviderSpecificSettings(msrest.serialization.Model): +class ReplicationProviderSpecificSettings(_serialization.Model): """Replication provider specific settings. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AReplicationDetails, A2ACrossClusterMigrationReplicationDetails, HyperVReplicaReplicationDetails, HyperVReplicaBlueReplicationDetails, HyperVReplicaAzureReplicationDetails, HyperVReplicaBaseReplicationDetails, InMageReplicationDetails, InMageAzureV2ReplicationDetails, InMageRcmReplicationDetails, InMageRcmFailbackReplicationDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AReplicationDetails, A2ACrossClusterMigrationReplicationDetails, + HyperVReplicaReplicationDetails, HyperVReplicaBlueReplicationDetails, + HyperVReplicaAzureReplicationDetails, HyperVReplicaBaseReplicationDetails, + InMageReplicationDetails, InMageAzureV2ReplicationDetails, InMageRcmReplicationDetails, + InMageRcmFailbackReplicationDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AReplicationDetails', 'A2ACrossClusterMigration': 'A2ACrossClusterMigrationReplicationDetails', 'HyperVReplica2012': 'HyperVReplicaReplicationDetails', 'HyperVReplica2012R2': 'HyperVReplicaBlueReplicationDetails', 'HyperVReplicaAzure': 'HyperVReplicaAzureReplicationDetails', 'HyperVReplicaBaseReplicationDetails': 'HyperVReplicaBaseReplicationDetails', 'InMage': 'InMageReplicationDetails', 'InMageAzureV2': 'InMageAzureV2ReplicationDetails', 'InMageRcm': 'InMageRcmReplicationDetails', 'InMageRcmFailback': 'InMageRcmFailbackReplicationDetails'} - } - - def __init__( - self, - **kwargs - ): - super(ReplicationProviderSpecificSettings, self).__init__(**kwargs) + "instance_type": { + "A2A": "A2AReplicationDetails", + "A2ACrossClusterMigration": "A2ACrossClusterMigrationReplicationDetails", + "HyperVReplica2012": "HyperVReplicaReplicationDetails", + "HyperVReplica2012R2": "HyperVReplicaBlueReplicationDetails", + "HyperVReplicaAzure": "HyperVReplicaAzureReplicationDetails", + "HyperVReplicaBaseReplicationDetails": "HyperVReplicaBaseReplicationDetails", + "InMage": "InMageReplicationDetails", + "InMageAzureV2": "InMageAzureV2ReplicationDetails", + "InMageRcm": "InMageRcmReplicationDetails", + "InMageRcmFailback": "InMageRcmFailbackReplicationDetails", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -652,37 +823,37 @@ class A2ACrossClusterMigrationReplicationDetails(ReplicationProviderSpecificSett All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param primary_fabric_location: Primary fabric location. - :type primary_fabric_location: str - :param os_type: The type of operating system. - :type os_type: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param lifecycle_id: An id associated with the PE that survives actions like switch protection + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. + :vartype fabric_object_id: str + :ivar primary_fabric_location: Primary fabric location. + :vartype primary_fabric_location: str + :ivar os_type: The type of operating system. + :vartype os_type: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar lifecycle_id: An id associated with the PE that survives actions like switch protection which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to have a link/continuity in being able to have an Id that denotes the "same" protected item even though other internal Ids/ARM Id might be changing. - :type lifecycle_id: str + :vartype lifecycle_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'primary_fabric_location': {'key': 'primaryFabricLocation', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'lifecycle_id': {'key': 'lifecycleId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "primary_fabric_location": {"key": "primaryFabricLocation", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, + "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, + "lifecycle_id": {"key": "lifecycleId", "type": "str"}, } def __init__( @@ -696,8 +867,25 @@ def __init__( lifecycle_id: Optional[str] = None, **kwargs ): - super(A2ACrossClusterMigrationReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'A2ACrossClusterMigration' # type: str + """ + :keyword fabric_object_id: The fabric specific object Id of the virtual machine. + :paramtype fabric_object_id: str + :keyword primary_fabric_location: Primary fabric location. + :paramtype primary_fabric_location: str + :keyword os_type: The type of operating system. + :paramtype os_type: str + :keyword vm_protection_state: The protection state for the vm. + :paramtype vm_protection_state: str + :keyword vm_protection_state_description: The protection state description for the vm. + :paramtype vm_protection_state_description: str + :keyword lifecycle_id: An id associated with the PE that survives actions like switch + protection which change the backing PE/CPE objects internally.The lifecycle id gets carried + forward to have a link/continuity in being able to have an Id that denotes the "same" protected + item even though other internal Ids/ARM Id might be changing. + :paramtype lifecycle_id: str + """ + super().__init__(**kwargs) + self.instance_type = "A2ACrossClusterMigration" # type: str self.fabric_object_id = fabric_object_id self.primary_fabric_location = primary_fabric_location self.os_type = os_type @@ -706,71 +894,79 @@ def __init__( self.lifecycle_id = lifecycle_id -class A2AEnableProtectionInput(EnableProtectionProviderSpecificInput): +class A2AEnableProtectionInput(EnableProtectionProviderSpecificInput): # pylint: disable=too-many-instance-attributes """A2A enable protection input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: Required. The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str - :param recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :type recovery_resource_group_id: str - :param recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :type recovery_cloud_service_id: str - :param recovery_availability_set_id: The recovery availability set Id. - :type recovery_availability_set_id: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :type recovery_proximity_placement_group_id: str - :param vm_disks: The list of vm disk details. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk details. - :type vm_managed_disks: + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. Required. + :vartype fabric_object_id: str + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :vartype recovery_resource_group_id: str + :ivar recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. + :vartype recovery_cloud_service_id: str + :ivar recovery_availability_set_id: The recovery availability set Id. + :vartype recovery_availability_set_id: str + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :vartype recovery_proximity_placement_group_id: str + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :ivar vm_managed_disks: The list of vm managed disk details. + :vartype vm_managed_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_group_id: The multi vm group id. - :type multi_vm_group_id: str - :param recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account_id: str - :param disk_encryption_info: The recovery disk encryption information (for two pass flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - :param recovery_azure_network_id: The recovery Azure virtual network ARM id. - :type recovery_azure_network_id: str - :param recovery_subnet_name: The recovery subnet name. - :type recovery_subnet_name: str - :param recovery_virtual_machine_scale_set_id: The virtual machine scale set Id. - :type recovery_virtual_machine_scale_set_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'fabric_object_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_cloud_service_id': {'key': 'recoveryCloudServiceId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AVmDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AVmManagedDiskInputDetails]'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'recovery_boot_diag_storage_account_id': {'key': 'recoveryBootDiagStorageAccountId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, - 'recovery_azure_network_id': {'key': 'recoveryAzureNetworkId', 'type': 'str'}, - 'recovery_subnet_name': {'key': 'recoverySubnetName', 'type': 'str'}, - 'recovery_virtual_machine_scale_set_id': {'key': 'recoveryVirtualMachineScaleSetId', 'type': 'str'}, + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_group_id: The multi vm group id. + :vartype multi_vm_group_id: str + :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account_id: str + :ivar disk_encryption_info: The recovery disk encryption information (for two pass flows). + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar recovery_extended_location: The recovery extended location. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_azure_network_id: The recovery Azure virtual network ARM id. + :vartype recovery_azure_network_id: str + :ivar recovery_subnet_name: The recovery subnet name. + :vartype recovery_subnet_name: str + :ivar recovery_virtual_machine_scale_set_id: The virtual machine scale set Id. + :vartype recovery_virtual_machine_scale_set_id: str + :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :vartype recovery_capacity_reservation_group_id: str + """ + + _validation = { + "instance_type": {"required": True}, + "fabric_object_id": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, + "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, + "recovery_cloud_service_id": {"key": "recoveryCloudServiceId", "type": "str"}, + "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, + "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, + "vm_disks": {"key": "vmDisks", "type": "[A2AVmDiskInputDetails]"}, + "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AVmManagedDiskInputDetails]"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, + "recovery_boot_diag_storage_account_id": {"key": "recoveryBootDiagStorageAccountId", "type": "str"}, + "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, + "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, + "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, + "recovery_azure_network_id": {"key": "recoveryAzureNetworkId", "type": "str"}, + "recovery_subnet_name": {"key": "recoverySubnetName", "type": "str"}, + "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, + "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, } def __init__( @@ -782,20 +978,64 @@ def __init__( recovery_cloud_service_id: Optional[str] = None, recovery_availability_set_id: Optional[str] = None, recovery_proximity_placement_group_id: Optional[str] = None, - vm_disks: Optional[List["A2AVmDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["A2AVmManagedDiskInputDetails"]] = None, + vm_disks: Optional[List["_models.A2AVmDiskInputDetails"]] = None, + vm_managed_disks: Optional[List["_models.A2AVmManagedDiskInputDetails"]] = None, multi_vm_group_name: Optional[str] = None, multi_vm_group_id: Optional[str] = None, recovery_boot_diag_storage_account_id: Optional[str] = None, - disk_encryption_info: Optional["DiskEncryptionInfo"] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, recovery_availability_zone: Optional[str] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = None, recovery_azure_network_id: Optional[str] = None, recovery_subnet_name: Optional[str] = None, recovery_virtual_machine_scale_set_id: Optional[str] = None, - **kwargs - ): - super(A2AEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + recovery_capacity_reservation_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword fabric_object_id: The fabric specific object Id of the virtual machine. Required. + :paramtype fabric_object_id: str + :keyword recovery_container_id: The recovery container Id. + :paramtype recovery_container_id: str + :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :paramtype recovery_resource_group_id: str + :keyword recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. + :paramtype recovery_cloud_service_id: str + :keyword recovery_availability_set_id: The recovery availability set Id. + :paramtype recovery_availability_set_id: str + :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :paramtype recovery_proximity_placement_group_id: str + :keyword vm_disks: The list of vm disk details. + :paramtype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :keyword vm_managed_disks: The list of vm managed disk details. + :paramtype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] + :keyword multi_vm_group_name: The multi vm group name. + :paramtype multi_vm_group_name: str + :keyword multi_vm_group_id: The multi vm group id. + :paramtype multi_vm_group_id: str + :keyword recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :paramtype recovery_boot_diag_storage_account_id: str + :keyword disk_encryption_info: The recovery disk encryption information (for two pass flows). + :paramtype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :keyword recovery_availability_zone: The recovery availability zone. + :paramtype recovery_availability_zone: str + :keyword recovery_extended_location: The recovery extended location. + :paramtype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :keyword recovery_azure_network_id: The recovery Azure virtual network ARM id. + :paramtype recovery_azure_network_id: str + :keyword recovery_subnet_name: The recovery subnet name. + :paramtype recovery_subnet_name: str + :keyword recovery_virtual_machine_scale_set_id: The virtual machine scale set Id. + :paramtype recovery_virtual_machine_scale_set_id: str + :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :paramtype recovery_capacity_reservation_group_id: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.fabric_object_id = fabric_object_id self.recovery_container_id = recovery_container_id self.recovery_resource_group_id = recovery_resource_group_id @@ -809,41 +1049,52 @@ def __init__( self.recovery_boot_diag_storage_account_id = recovery_boot_diag_storage_account_id self.disk_encryption_info = disk_encryption_info self.recovery_availability_zone = recovery_availability_zone + self.recovery_extended_location = recovery_extended_location self.recovery_azure_network_id = recovery_azure_network_id self.recovery_subnet_name = recovery_subnet_name self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id + self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id -class EventProviderSpecificDetails(msrest.serialization.Model): +class EventProviderSpecificDetails(_serialization.Model): """Model class for provider specific details for an event. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AEventDetails, HyperVReplica2012EventDetails, HyperVReplica2012R2EventDetails, HyperVReplicaAzureEventDetails, HyperVReplicaBaseEventDetails, InMageAzureV2EventDetails, InMageRcmEventDetails, InMageRcmFailbackEventDetails, VMwareCbtEventDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AEventDetails, HyperVReplica2012EventDetails, HyperVReplica2012R2EventDetails, + HyperVReplicaAzureEventDetails, HyperVReplicaBaseEventDetails, InMageAzureV2EventDetails, + InMageRcmEventDetails, InMageRcmFailbackEventDetails, VMwareCbtEventDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AEventDetails', 'HyperVReplica2012': 'HyperVReplica2012EventDetails', 'HyperVReplica2012R2': 'HyperVReplica2012R2EventDetails', 'HyperVReplicaAzure': 'HyperVReplicaAzureEventDetails', 'HyperVReplicaBaseEventDetails': 'HyperVReplicaBaseEventDetails', 'InMageAzureV2': 'InMageAzureV2EventDetails', 'InMageRcm': 'InMageRcmEventDetails', 'InMageRcmFailback': 'InMageRcmFailbackEventDetails', 'VMwareCbt': 'VMwareCbtEventDetails'} - } - - def __init__( - self, - **kwargs - ): - super(EventProviderSpecificDetails, self).__init__(**kwargs) + "instance_type": { + "A2A": "A2AEventDetails", + "HyperVReplica2012": "HyperVReplica2012EventDetails", + "HyperVReplica2012R2": "HyperVReplica2012R2EventDetails", + "HyperVReplicaAzure": "HyperVReplicaAzureEventDetails", + "HyperVReplicaBaseEventDetails": "HyperVReplicaBaseEventDetails", + "InMageAzureV2": "InMageAzureV2EventDetails", + "InMageRcm": "InMageRcmEventDetails", + "InMageRcmFailback": "InMageRcmFailbackEventDetails", + "VMwareCbt": "VMwareCbtEventDetails", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -852,35 +1103,34 @@ class A2AEventDetails(EventProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param protected_item_name: The protected item arm name. - :type protected_item_name: str - :param fabric_object_id: The azure vm arm id. - :type fabric_object_id: str - :param fabric_name: Fabric arm name. - :type fabric_name: str - :param fabric_location: The fabric location. - :type fabric_location: str - :param remote_fabric_name: Remote fabric arm name. - :type remote_fabric_name: str - :param remote_fabric_location: Remote fabric location. - :type remote_fabric_location: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar protected_item_name: The protected item arm name. + :vartype protected_item_name: str + :ivar fabric_object_id: The azure vm arm id. + :vartype fabric_object_id: str + :ivar fabric_name: Fabric arm name. + :vartype fabric_name: str + :ivar fabric_location: The fabric location. + :vartype fabric_location: str + :ivar remote_fabric_name: Remote fabric arm name. + :vartype remote_fabric_name: str + :ivar remote_fabric_location: Remote fabric location. + :vartype remote_fabric_location: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'protected_item_name': {'key': 'protectedItemName', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'fabric_location': {'key': 'fabricLocation', 'type': 'str'}, - 'remote_fabric_name': {'key': 'remoteFabricName', 'type': 'str'}, - 'remote_fabric_location': {'key': 'remoteFabricLocation', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "protected_item_name": {"key": "protectedItemName", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "fabric_location": {"key": "fabricLocation", "type": "str"}, + "remote_fabric_name": {"key": "remoteFabricName", "type": "str"}, + "remote_fabric_location": {"key": "remoteFabricLocation", "type": "str"}, } def __init__( @@ -894,8 +1144,22 @@ def __init__( remote_fabric_location: Optional[str] = None, **kwargs ): - super(A2AEventDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword protected_item_name: The protected item arm name. + :paramtype protected_item_name: str + :keyword fabric_object_id: The azure vm arm id. + :paramtype fabric_object_id: str + :keyword fabric_name: Fabric arm name. + :paramtype fabric_name: str + :keyword fabric_location: The fabric location. + :paramtype fabric_location: str + :keyword remote_fabric_name: Remote fabric arm name. + :paramtype remote_fabric_name: str + :keyword remote_fabric_location: Remote fabric location. + :paramtype remote_fabric_location: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.protected_item_name = protected_item_name self.fabric_object_id = fabric_object_id self.fabric_name = fabric_name @@ -909,82 +1173,109 @@ class A2APolicyCreationInput(PolicyProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_history: The duration in minutes until which the recovery points need to + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_history: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + :vartype recovery_point_history: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: Required. A value indicating whether multi-VM sync has to be - enabled. Value should be 'Enabled' or 'Disabled'. Possible values include: "Enable", "Disable". - :type multi_vm_sync_status: str or + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value + should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :vartype multi_vm_sync_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus """ _validation = { - 'instance_type': {'required': True}, - 'multi_vm_sync_status': {'required': True}, + "instance_type": {"required": True}, + "multi_vm_sync_status": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, } def __init__( self, *, - multi_vm_sync_status: Union[str, "SetMultiVmSyncStatus"], + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], recovery_point_history: Optional[int] = None, crash_consistent_frequency_in_minutes: Optional[int] = None, app_consistent_frequency_in_minutes: Optional[int] = None, **kwargs ): - super(A2APolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword recovery_point_history: The duration in minutes until which the recovery points need + to be stored. + :paramtype recovery_point_history: int + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :paramtype crash_consistent_frequency_in_minutes: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in + minutes). + :paramtype app_consistent_frequency_in_minutes: int + :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + Value should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :paramtype multi_vm_sync_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.recovery_point_history = recovery_point_history self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes self.multi_vm_sync_status = multi_vm_sync_status -class PolicyProviderSpecificDetails(msrest.serialization.Model): +class PolicyProviderSpecificDetails(_serialization.Model): """Base class for Provider specific details for policies. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2APolicyDetails, HyperVReplicaPolicyDetails, HyperVReplicaBluePolicyDetails, HyperVReplicaAzurePolicyDetails, HyperVReplicaBasePolicyDetails, InMagePolicyDetails, InMageAzureV2PolicyDetails, InMageBasePolicyDetails, InMageRcmPolicyDetails, InMageRcmFailbackPolicyDetails, VmwareCbtPolicyDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2APolicyDetails, HyperVReplicaPolicyDetails, HyperVReplicaBluePolicyDetails, + HyperVReplicaAzurePolicyDetails, HyperVReplicaBasePolicyDetails, InMagePolicyDetails, + InMageAzureV2PolicyDetails, InMageBasePolicyDetails, InMageRcmPolicyDetails, + InMageRcmFailbackPolicyDetails, VmwareCbtPolicyDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2APolicyDetails', 'HyperVReplica2012': 'HyperVReplicaPolicyDetails', 'HyperVReplica2012R2': 'HyperVReplicaBluePolicyDetails', 'HyperVReplicaAzure': 'HyperVReplicaAzurePolicyDetails', 'HyperVReplicaBasePolicyDetails': 'HyperVReplicaBasePolicyDetails', 'InMage': 'InMagePolicyDetails', 'InMageAzureV2': 'InMageAzureV2PolicyDetails', 'InMageBasePolicyDetails': 'InMageBasePolicyDetails', 'InMageRcm': 'InMageRcmPolicyDetails', 'InMageRcmFailback': 'InMageRcmFailbackPolicyDetails', 'VMwareCbt': 'VmwareCbtPolicyDetails'} - } - - def __init__( - self, - **kwargs - ): - super(PolicyProviderSpecificDetails, self).__init__(**kwargs) + "instance_type": { + "A2A": "A2APolicyDetails", + "HyperVReplica2012": "HyperVReplicaPolicyDetails", + "HyperVReplica2012R2": "HyperVReplicaBluePolicyDetails", + "HyperVReplicaAzure": "HyperVReplicaAzurePolicyDetails", + "HyperVReplicaBasePolicyDetails": "HyperVReplicaBasePolicyDetails", + "InMage": "InMagePolicyDetails", + "InMageAzureV2": "InMageAzureV2PolicyDetails", + "InMageBasePolicyDetails": "InMageBasePolicyDetails", + "InMageRcm": "InMageRcmPolicyDetails", + "InMageRcmFailback": "InMageRcmFailbackPolicyDetails", + "VMwareCbt": "VmwareCbtPolicyDetails", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -993,34 +1284,33 @@ class A2APolicyDetails(PolicyProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :type multi_vm_sync_status: str - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :vartype multi_vm_sync_status: str + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in minutes. - :type crash_consistent_frequency_in_minutes: int + :vartype crash_consistent_frequency_in_minutes: int """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, + "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, } def __init__( @@ -1033,8 +1323,22 @@ def __init__( crash_consistent_frequency_in_minutes: Optional[int] = None, **kwargs ): - super(A2APolicyDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :paramtype recovery_point_threshold_in_minutes: int + :keyword recovery_point_history: The duration in minutes until which the recovery points need + to be stored. + :paramtype recovery_point_history: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :paramtype app_consistent_frequency_in_minutes: int + :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :paramtype multi_vm_sync_status: str + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :paramtype crash_consistent_frequency_in_minutes: int + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes self.recovery_point_history = recovery_point_history self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes @@ -1042,84 +1346,87 @@ def __init__( self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes -class A2AProtectedDiskDetails(msrest.serialization.Model): +class A2AProtectedDiskDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """A2A protected disk details. - :param disk_uri: The disk uri. - :type disk_uri: str - :param recovery_azure_storage_account_id: The recovery disk storage account. - :type recovery_azure_storage_account_id: str - :param primary_disk_azure_storage_account_id: The primary disk storage account. - :type primary_disk_azure_storage_account_id: str - :param recovery_disk_uri: Recovery disk uri. - :type recovery_disk_uri: str - :param disk_name: The disk name. - :type disk_name: str - :param disk_capacity_in_bytes: The disk capacity in bytes. - :type disk_capacity_in_bytes: long - :param primary_staging_azure_storage_account_id: The primary staging storage account. - :type primary_staging_azure_storage_account_id: str - :param disk_type: The type of disk. - :type disk_type: str - :param resync_required: A value indicating whether resync is required for this disk. - :type resync_required: bool - :param monitoring_percentage_completion: The percentage of the monitoring job. The type of the + :ivar disk_uri: The disk uri. + :vartype disk_uri: str + :ivar recovery_azure_storage_account_id: The recovery disk storage account. + :vartype recovery_azure_storage_account_id: str + :ivar primary_disk_azure_storage_account_id: The primary disk storage account. + :vartype primary_disk_azure_storage_account_id: str + :ivar recovery_disk_uri: Recovery disk uri. + :vartype recovery_disk_uri: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar disk_capacity_in_bytes: The disk capacity in bytes. + :vartype disk_capacity_in_bytes: int + :ivar primary_staging_azure_storage_account_id: The primary staging storage account. + :vartype primary_staging_azure_storage_account_id: str + :ivar disk_type: The type of disk. + :vartype disk_type: str + :ivar resync_required: A value indicating whether resync is required for this disk. + :vartype resync_required: bool + :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. - :type monitoring_percentage_completion: int - :param monitoring_job_type: The type of the monitoring job. The progress is contained in + :vartype monitoring_percentage_completion: int + :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. - :type monitoring_job_type: str - :param data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at + :vartype monitoring_job_type: str + :ivar data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at staging account. - :type data_pending_in_staging_storage_account_in_mb: float - :param data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. - :type data_pending_at_source_agent_in_mb: float - :param disk_state: The disk state. - :type disk_state: str - :param allowed_disk_level_operation: The disk level operations list. - :type allowed_disk_level_operation: list[str] - :param is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. - :type is_disk_encrypted: bool - :param secret_identifier: The secret URL / identifier (BEK). - :type secret_identifier: str - :param dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). - :type dek_key_vault_arm_id: str - :param is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. - :type is_disk_key_encrypted: bool - :param key_identifier: The key URL / identifier (KEK). - :type key_identifier: str - :param kek_key_vault_arm_id: The KeyVault resource id for key (KEK). - :type kek_key_vault_arm_id: str - :param failover_disk_name: The failover name for the managed disk. - :type failover_disk_name: str - :param tfo_disk_name: The test failover name for the managed disk. - :type tfo_disk_name: str - """ - - _attribute_map = { - 'disk_uri': {'key': 'diskUri', 'type': 'str'}, - 'recovery_azure_storage_account_id': {'key': 'recoveryAzureStorageAccountId', 'type': 'str'}, - 'primary_disk_azure_storage_account_id': {'key': 'primaryDiskAzureStorageAccountId', 'type': 'str'}, - 'recovery_disk_uri': {'key': 'recoveryDiskUri', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'disk_capacity_in_bytes': {'key': 'diskCapacityInBytes', 'type': 'long'}, - 'primary_staging_azure_storage_account_id': {'key': 'primaryStagingAzureStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'bool'}, - 'monitoring_percentage_completion': {'key': 'monitoringPercentageCompletion', 'type': 'int'}, - 'monitoring_job_type': {'key': 'monitoringJobType', 'type': 'str'}, - 'data_pending_in_staging_storage_account_in_mb': {'key': 'dataPendingInStagingStorageAccountInMB', 'type': 'float'}, - 'data_pending_at_source_agent_in_mb': {'key': 'dataPendingAtSourceAgentInMB', 'type': 'float'}, - 'disk_state': {'key': 'diskState', 'type': 'str'}, - 'allowed_disk_level_operation': {'key': 'allowedDiskLevelOperation', 'type': '[str]'}, - 'is_disk_encrypted': {'key': 'isDiskEncrypted', 'type': 'bool'}, - 'secret_identifier': {'key': 'secretIdentifier', 'type': 'str'}, - 'dek_key_vault_arm_id': {'key': 'dekKeyVaultArmId', 'type': 'str'}, - 'is_disk_key_encrypted': {'key': 'isDiskKeyEncrypted', 'type': 'bool'}, - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'kek_key_vault_arm_id': {'key': 'kekKeyVaultArmId', 'type': 'str'}, - 'failover_disk_name': {'key': 'failoverDiskName', 'type': 'str'}, - 'tfo_disk_name': {'key': 'tfoDiskName', 'type': 'str'}, + :vartype data_pending_in_staging_storage_account_in_mb: float + :ivar data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. + :vartype data_pending_at_source_agent_in_mb: float + :ivar disk_state: The disk state. + :vartype disk_state: str + :ivar allowed_disk_level_operation: The disk level operations list. + :vartype allowed_disk_level_operation: list[str] + :ivar is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. + :vartype is_disk_encrypted: bool + :ivar secret_identifier: The secret URL / identifier (BEK). + :vartype secret_identifier: str + :ivar dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). + :vartype dek_key_vault_arm_id: str + :ivar is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. + :vartype is_disk_key_encrypted: bool + :ivar key_identifier: The key URL / identifier (KEK). + :vartype key_identifier: str + :ivar kek_key_vault_arm_id: The KeyVault resource id for key (KEK). + :vartype kek_key_vault_arm_id: str + :ivar failover_disk_name: The failover name for the managed disk. + :vartype failover_disk_name: str + :ivar tfo_disk_name: The test failover name for the managed disk. + :vartype tfo_disk_name: str + """ + + _attribute_map = { + "disk_uri": {"key": "diskUri", "type": "str"}, + "recovery_azure_storage_account_id": {"key": "recoveryAzureStorageAccountId", "type": "str"}, + "primary_disk_azure_storage_account_id": {"key": "primaryDiskAzureStorageAccountId", "type": "str"}, + "recovery_disk_uri": {"key": "recoveryDiskUri", "type": "str"}, + "disk_name": {"key": "diskName", "type": "str"}, + "disk_capacity_in_bytes": {"key": "diskCapacityInBytes", "type": "int"}, + "primary_staging_azure_storage_account_id": {"key": "primaryStagingAzureStorageAccountId", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "resync_required": {"key": "resyncRequired", "type": "bool"}, + "monitoring_percentage_completion": {"key": "monitoringPercentageCompletion", "type": "int"}, + "monitoring_job_type": {"key": "monitoringJobType", "type": "str"}, + "data_pending_in_staging_storage_account_in_mb": { + "key": "dataPendingInStagingStorageAccountInMB", + "type": "float", + }, + "data_pending_at_source_agent_in_mb": {"key": "dataPendingAtSourceAgentInMB", "type": "float"}, + "disk_state": {"key": "diskState", "type": "str"}, + "allowed_disk_level_operation": {"key": "allowedDiskLevelOperation", "type": "[str]"}, + "is_disk_encrypted": {"key": "isDiskEncrypted", "type": "bool"}, + "secret_identifier": {"key": "secretIdentifier", "type": "str"}, + "dek_key_vault_arm_id": {"key": "dekKeyVaultArmId", "type": "str"}, + "is_disk_key_encrypted": {"key": "isDiskKeyEncrypted", "type": "bool"}, + "key_identifier": {"key": "keyIdentifier", "type": "str"}, + "kek_key_vault_arm_id": {"key": "kekKeyVaultArmId", "type": "str"}, + "failover_disk_name": {"key": "failoverDiskName", "type": "str"}, + "tfo_disk_name": {"key": "tfoDiskName", "type": "str"}, } def __init__( @@ -1150,7 +1457,58 @@ def __init__( tfo_disk_name: Optional[str] = None, **kwargs ): - super(A2AProtectedDiskDetails, self).__init__(**kwargs) + """ + :keyword disk_uri: The disk uri. + :paramtype disk_uri: str + :keyword recovery_azure_storage_account_id: The recovery disk storage account. + :paramtype recovery_azure_storage_account_id: str + :keyword primary_disk_azure_storage_account_id: The primary disk storage account. + :paramtype primary_disk_azure_storage_account_id: str + :keyword recovery_disk_uri: Recovery disk uri. + :paramtype recovery_disk_uri: str + :keyword disk_name: The disk name. + :paramtype disk_name: str + :keyword disk_capacity_in_bytes: The disk capacity in bytes. + :paramtype disk_capacity_in_bytes: int + :keyword primary_staging_azure_storage_account_id: The primary staging storage account. + :paramtype primary_staging_azure_storage_account_id: str + :keyword disk_type: The type of disk. + :paramtype disk_type: str + :keyword resync_required: A value indicating whether resync is required for this disk. + :paramtype resync_required: bool + :keyword monitoring_percentage_completion: The percentage of the monitoring job. The type of + the monitoring job is defined by MonitoringJobType property. + :paramtype monitoring_percentage_completion: int + :keyword monitoring_job_type: The type of the monitoring job. The progress is contained in + MonitoringPercentageCompletion property. + :paramtype monitoring_job_type: str + :keyword data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB + at staging account. + :paramtype data_pending_in_staging_storage_account_in_mb: float + :keyword data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. + :paramtype data_pending_at_source_agent_in_mb: float + :keyword disk_state: The disk state. + :paramtype disk_state: str + :keyword allowed_disk_level_operation: The disk level operations list. + :paramtype allowed_disk_level_operation: list[str] + :keyword is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. + :paramtype is_disk_encrypted: bool + :keyword secret_identifier: The secret URL / identifier (BEK). + :paramtype secret_identifier: str + :keyword dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). + :paramtype dek_key_vault_arm_id: str + :keyword is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. + :paramtype is_disk_key_encrypted: bool + :keyword key_identifier: The key URL / identifier (KEK). + :paramtype key_identifier: str + :keyword kek_key_vault_arm_id: The KeyVault resource id for key (KEK). + :paramtype kek_key_vault_arm_id: str + :keyword failover_disk_name: The failover name for the managed disk. + :paramtype failover_disk_name: str + :keyword tfo_disk_name: The test failover name for the managed disk. + :paramtype tfo_disk_name: str + """ + super().__init__(**kwargs) self.disk_uri = disk_uri self.recovery_azure_storage_account_id = recovery_azure_storage_account_id self.primary_disk_azure_storage_account_id = primary_disk_azure_storage_account_id @@ -1176,104 +1534,107 @@ def __init__( self.tfo_disk_name = tfo_disk_name -class A2AProtectedManagedDiskDetails(msrest.serialization.Model): +class A2AProtectedManagedDiskDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """A2A protected managed disk details. - :param disk_id: The managed disk Arm id. - :type disk_id: str - :param recovery_resource_group_id: The recovery disk resource group Arm Id. - :type recovery_resource_group_id: str - :param recovery_target_disk_id: Recovery target disk Arm Id. - :type recovery_target_disk_id: str - :param recovery_replica_disk_id: Recovery replica disk Arm Id. - :type recovery_replica_disk_id: str - :param recovery_orignal_target_disk_id: Recovery original target disk Arm Id. - :type recovery_orignal_target_disk_id: str - :param recovery_replica_disk_account_type: The replica disk type. Its an optional value and - will be same as source disk type if not user provided. - :type recovery_replica_disk_account_type: str - :param recovery_target_disk_account_type: The target disk type after failover. Its an optional + :ivar disk_id: The managed disk Arm id. + :vartype disk_id: str + :ivar recovery_resource_group_id: The recovery disk resource group Arm Id. + :vartype recovery_resource_group_id: str + :ivar recovery_target_disk_id: Recovery target disk Arm Id. + :vartype recovery_target_disk_id: str + :ivar recovery_replica_disk_id: Recovery replica disk Arm Id. + :vartype recovery_replica_disk_id: str + :ivar recovery_orignal_target_disk_id: Recovery original target disk Arm Id. + :vartype recovery_orignal_target_disk_id: str + :ivar recovery_replica_disk_account_type: The replica disk type. Its an optional value and will + be same as source disk type if not user provided. + :vartype recovery_replica_disk_account_type: str + :ivar recovery_target_disk_account_type: The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. - :type recovery_target_disk_account_type: str - :param recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :type recovery_disk_encryption_set_id: str - :param primary_disk_encryption_set_id: The primary disk encryption set Id. - :type primary_disk_encryption_set_id: str - :param disk_name: The disk name. - :type disk_name: str - :param disk_capacity_in_bytes: The disk capacity in bytes. - :type disk_capacity_in_bytes: long - :param primary_staging_azure_storage_account_id: The primary staging storage account. - :type primary_staging_azure_storage_account_id: str - :param disk_type: The type of disk. - :type disk_type: str - :param resync_required: A value indicating whether resync is required for this disk. - :type resync_required: bool - :param monitoring_percentage_completion: The percentage of the monitoring job. The type of the + :vartype recovery_target_disk_account_type: str + :ivar recovery_disk_encryption_set_id: The recovery disk encryption set Id. + :vartype recovery_disk_encryption_set_id: str + :ivar primary_disk_encryption_set_id: The primary disk encryption set Id. + :vartype primary_disk_encryption_set_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar disk_capacity_in_bytes: The disk capacity in bytes. + :vartype disk_capacity_in_bytes: int + :ivar primary_staging_azure_storage_account_id: The primary staging storage account. + :vartype primary_staging_azure_storage_account_id: str + :ivar disk_type: The type of disk. + :vartype disk_type: str + :ivar resync_required: A value indicating whether resync is required for this disk. + :vartype resync_required: bool + :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. - :type monitoring_percentage_completion: int - :param monitoring_job_type: The type of the monitoring job. The progress is contained in + :vartype monitoring_percentage_completion: int + :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. - :type monitoring_job_type: str - :param data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at + :vartype monitoring_job_type: str + :ivar data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at staging account. - :type data_pending_in_staging_storage_account_in_mb: float - :param data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. - :type data_pending_at_source_agent_in_mb: float - :param disk_state: The disk state. - :type disk_state: str - :param allowed_disk_level_operation: The disk level operations list. - :type allowed_disk_level_operation: list[str] - :param is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. - :type is_disk_encrypted: bool - :param secret_identifier: The secret URL / identifier (BEK). - :type secret_identifier: str - :param dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). - :type dek_key_vault_arm_id: str - :param is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. - :type is_disk_key_encrypted: bool - :param key_identifier: The key URL / identifier (KEK). - :type key_identifier: str - :param kek_key_vault_arm_id: The KeyVault resource id for key (KEK). - :type kek_key_vault_arm_id: str - :param failover_disk_name: The failover name for the managed disk. - :type failover_disk_name: str - :param tfo_disk_name: The test failover name for the managed disk. - :type tfo_disk_name: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_target_disk_id': {'key': 'recoveryTargetDiskId', 'type': 'str'}, - 'recovery_replica_disk_id': {'key': 'recoveryReplicaDiskId', 'type': 'str'}, - 'recovery_orignal_target_disk_id': {'key': 'recoveryOrignalTargetDiskId', 'type': 'str'}, - 'recovery_replica_disk_account_type': {'key': 'recoveryReplicaDiskAccountType', 'type': 'str'}, - 'recovery_target_disk_account_type': {'key': 'recoveryTargetDiskAccountType', 'type': 'str'}, - 'recovery_disk_encryption_set_id': {'key': 'recoveryDiskEncryptionSetId', 'type': 'str'}, - 'primary_disk_encryption_set_id': {'key': 'primaryDiskEncryptionSetId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'disk_capacity_in_bytes': {'key': 'diskCapacityInBytes', 'type': 'long'}, - 'primary_staging_azure_storage_account_id': {'key': 'primaryStagingAzureStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'bool'}, - 'monitoring_percentage_completion': {'key': 'monitoringPercentageCompletion', 'type': 'int'}, - 'monitoring_job_type': {'key': 'monitoringJobType', 'type': 'str'}, - 'data_pending_in_staging_storage_account_in_mb': {'key': 'dataPendingInStagingStorageAccountInMB', 'type': 'float'}, - 'data_pending_at_source_agent_in_mb': {'key': 'dataPendingAtSourceAgentInMB', 'type': 'float'}, - 'disk_state': {'key': 'diskState', 'type': 'str'}, - 'allowed_disk_level_operation': {'key': 'allowedDiskLevelOperation', 'type': '[str]'}, - 'is_disk_encrypted': {'key': 'isDiskEncrypted', 'type': 'bool'}, - 'secret_identifier': {'key': 'secretIdentifier', 'type': 'str'}, - 'dek_key_vault_arm_id': {'key': 'dekKeyVaultArmId', 'type': 'str'}, - 'is_disk_key_encrypted': {'key': 'isDiskKeyEncrypted', 'type': 'bool'}, - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'kek_key_vault_arm_id': {'key': 'kekKeyVaultArmId', 'type': 'str'}, - 'failover_disk_name': {'key': 'failoverDiskName', 'type': 'str'}, - 'tfo_disk_name': {'key': 'tfoDiskName', 'type': 'str'}, - } - - def __init__( + :vartype data_pending_in_staging_storage_account_in_mb: float + :ivar data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. + :vartype data_pending_at_source_agent_in_mb: float + :ivar disk_state: The disk state. + :vartype disk_state: str + :ivar allowed_disk_level_operation: The disk level operations list. + :vartype allowed_disk_level_operation: list[str] + :ivar is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. + :vartype is_disk_encrypted: bool + :ivar secret_identifier: The secret URL / identifier (BEK). + :vartype secret_identifier: str + :ivar dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). + :vartype dek_key_vault_arm_id: str + :ivar is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. + :vartype is_disk_key_encrypted: bool + :ivar key_identifier: The key URL / identifier (KEK). + :vartype key_identifier: str + :ivar kek_key_vault_arm_id: The KeyVault resource id for key (KEK). + :vartype kek_key_vault_arm_id: str + :ivar failover_disk_name: The failover name for the managed disk. + :vartype failover_disk_name: str + :ivar tfo_disk_name: The test failover name for the managed disk. + :vartype tfo_disk_name: str + """ + + _attribute_map = { + "disk_id": {"key": "diskId", "type": "str"}, + "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, + "recovery_target_disk_id": {"key": "recoveryTargetDiskId", "type": "str"}, + "recovery_replica_disk_id": {"key": "recoveryReplicaDiskId", "type": "str"}, + "recovery_orignal_target_disk_id": {"key": "recoveryOrignalTargetDiskId", "type": "str"}, + "recovery_replica_disk_account_type": {"key": "recoveryReplicaDiskAccountType", "type": "str"}, + "recovery_target_disk_account_type": {"key": "recoveryTargetDiskAccountType", "type": "str"}, + "recovery_disk_encryption_set_id": {"key": "recoveryDiskEncryptionSetId", "type": "str"}, + "primary_disk_encryption_set_id": {"key": "primaryDiskEncryptionSetId", "type": "str"}, + "disk_name": {"key": "diskName", "type": "str"}, + "disk_capacity_in_bytes": {"key": "diskCapacityInBytes", "type": "int"}, + "primary_staging_azure_storage_account_id": {"key": "primaryStagingAzureStorageAccountId", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "resync_required": {"key": "resyncRequired", "type": "bool"}, + "monitoring_percentage_completion": {"key": "monitoringPercentageCompletion", "type": "int"}, + "monitoring_job_type": {"key": "monitoringJobType", "type": "str"}, + "data_pending_in_staging_storage_account_in_mb": { + "key": "dataPendingInStagingStorageAccountInMB", + "type": "float", + }, + "data_pending_at_source_agent_in_mb": {"key": "dataPendingAtSourceAgentInMB", "type": "float"}, + "disk_state": {"key": "diskState", "type": "str"}, + "allowed_disk_level_operation": {"key": "allowedDiskLevelOperation", "type": "[str]"}, + "is_disk_encrypted": {"key": "isDiskEncrypted", "type": "bool"}, + "secret_identifier": {"key": "secretIdentifier", "type": "str"}, + "dek_key_vault_arm_id": {"key": "dekKeyVaultArmId", "type": "str"}, + "is_disk_key_encrypted": {"key": "isDiskKeyEncrypted", "type": "bool"}, + "key_identifier": {"key": "keyIdentifier", "type": "str"}, + "kek_key_vault_arm_id": {"key": "kekKeyVaultArmId", "type": "str"}, + "failover_disk_name": {"key": "failoverDiskName", "type": "str"}, + "tfo_disk_name": {"key": "tfoDiskName", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, disk_id: Optional[str] = None, @@ -1306,7 +1667,70 @@ def __init__( tfo_disk_name: Optional[str] = None, **kwargs ): - super(A2AProtectedManagedDiskDetails, self).__init__(**kwargs) + """ + :keyword disk_id: The managed disk Arm id. + :paramtype disk_id: str + :keyword recovery_resource_group_id: The recovery disk resource group Arm Id. + :paramtype recovery_resource_group_id: str + :keyword recovery_target_disk_id: Recovery target disk Arm Id. + :paramtype recovery_target_disk_id: str + :keyword recovery_replica_disk_id: Recovery replica disk Arm Id. + :paramtype recovery_replica_disk_id: str + :keyword recovery_orignal_target_disk_id: Recovery original target disk Arm Id. + :paramtype recovery_orignal_target_disk_id: str + :keyword recovery_replica_disk_account_type: The replica disk type. Its an optional value and + will be same as source disk type if not user provided. + :paramtype recovery_replica_disk_account_type: str + :keyword recovery_target_disk_account_type: The target disk type after failover. Its an + optional value and will be same as source disk type if not user provided. + :paramtype recovery_target_disk_account_type: str + :keyword recovery_disk_encryption_set_id: The recovery disk encryption set Id. + :paramtype recovery_disk_encryption_set_id: str + :keyword primary_disk_encryption_set_id: The primary disk encryption set Id. + :paramtype primary_disk_encryption_set_id: str + :keyword disk_name: The disk name. + :paramtype disk_name: str + :keyword disk_capacity_in_bytes: The disk capacity in bytes. + :paramtype disk_capacity_in_bytes: int + :keyword primary_staging_azure_storage_account_id: The primary staging storage account. + :paramtype primary_staging_azure_storage_account_id: str + :keyword disk_type: The type of disk. + :paramtype disk_type: str + :keyword resync_required: A value indicating whether resync is required for this disk. + :paramtype resync_required: bool + :keyword monitoring_percentage_completion: The percentage of the monitoring job. The type of + the monitoring job is defined by MonitoringJobType property. + :paramtype monitoring_percentage_completion: int + :keyword monitoring_job_type: The type of the monitoring job. The progress is contained in + MonitoringPercentageCompletion property. + :paramtype monitoring_job_type: str + :keyword data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB + at staging account. + :paramtype data_pending_in_staging_storage_account_in_mb: float + :keyword data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. + :paramtype data_pending_at_source_agent_in_mb: float + :keyword disk_state: The disk state. + :paramtype disk_state: str + :keyword allowed_disk_level_operation: The disk level operations list. + :paramtype allowed_disk_level_operation: list[str] + :keyword is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. + :paramtype is_disk_encrypted: bool + :keyword secret_identifier: The secret URL / identifier (BEK). + :paramtype secret_identifier: str + :keyword dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). + :paramtype dek_key_vault_arm_id: str + :keyword is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. + :paramtype is_disk_key_encrypted: bool + :keyword key_identifier: The key URL / identifier (KEK). + :paramtype key_identifier: str + :keyword kek_key_vault_arm_id: The KeyVault resource id for key (KEK). + :paramtype kek_key_vault_arm_id: str + :keyword failover_disk_name: The failover name for the managed disk. + :paramtype failover_disk_name: str + :keyword tfo_disk_name: The test failover name for the managed disk. + :paramtype tfo_disk_name: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.recovery_resource_group_id = recovery_resource_group_id self.recovery_target_disk_id = recovery_target_disk_id @@ -1337,36 +1761,38 @@ def __init__( self.tfo_disk_name = tfo_disk_name -class ProtectionContainerMappingProviderSpecificDetails(msrest.serialization.Model): +class ProtectionContainerMappingProviderSpecificDetails(_serialization.Model): """Container mapping provider specific details. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AProtectionContainerMappingDetails, InMageRcmProtectionContainerMappingDetails, VMwareCbtProtectionContainerMappingDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AProtectionContainerMappingDetails, InMageRcmProtectionContainerMappingDetails, + VMwareCbtProtectionContainerMappingDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AProtectionContainerMappingDetails', 'InMageRcm': 'InMageRcmProtectionContainerMappingDetails', 'VMwareCbt': 'VMwareCbtProtectionContainerMappingDetails'} + "instance_type": { + "A2A": "A2AProtectionContainerMappingDetails", + "InMageRcm": "InMageRcmProtectionContainerMappingDetails", + "VMwareCbt": "VMwareCbtProtectionContainerMappingDetails", + } } - def __init__( - self, - **kwargs - ): - super(ProtectionContainerMappingProviderSpecificDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -1375,142 +1801,213 @@ class A2AProtectionContainerMappingDetails(ProtectionContainerMappingProviderSpe All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param agent_auto_update_status: A value indicating whether the auto update is enabled. - Possible values include: "Disabled", "Enabled". - :type agent_auto_update_status: str or + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :param automation_account_arm_id: The automation account arm id. - :type automation_account_arm_id: str - :param schedule_name: The schedule arm name. - :type schedule_name: str - :param job_schedule_name: The job schedule arm name. - :type job_schedule_name: str + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + :ivar automation_account_authentication_type: A value indicating the type authentication to use + for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + :ivar schedule_name: The schedule arm name. + :vartype schedule_name: str + :ivar job_schedule_name: The job schedule arm name. + :vartype job_schedule_name: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'agent_auto_update_status': {'key': 'agentAutoUpdateStatus', 'type': 'str'}, - 'automation_account_arm_id': {'key': 'automationAccountArmId', 'type': 'str'}, - 'schedule_name': {'key': 'scheduleName', 'type': 'str'}, - 'job_schedule_name': {'key': 'jobScheduleName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, + "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, + "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, + "schedule_name": {"key": "scheduleName", "type": "str"}, + "job_schedule_name": {"key": "jobScheduleName", "type": "str"}, } def __init__( self, *, - agent_auto_update_status: Optional[Union[str, "AgentAutoUpdateStatus"]] = None, + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, automation_account_arm_id: Optional[str] = None, + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = None, schedule_name: Optional[str] = None, job_schedule_name: Optional[str] = None, **kwargs ): - super(A2AProtectionContainerMappingDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :paramtype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :keyword automation_account_arm_id: The automation account arm id. + :paramtype automation_account_arm_id: str + :keyword automation_account_authentication_type: A value indicating the type authentication to + use for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :paramtype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + :keyword schedule_name: The schedule arm name. + :paramtype schedule_name: str + :keyword job_schedule_name: The job schedule arm name. + :paramtype job_schedule_name: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.agent_auto_update_status = agent_auto_update_status self.automation_account_arm_id = automation_account_arm_id + self.automation_account_authentication_type = automation_account_authentication_type self.schedule_name = schedule_name self.job_schedule_name = job_schedule_name -class A2AProtectionIntentDiskInputDetails(msrest.serialization.Model): +class A2AProtectionIntentDiskInputDetails(_serialization.Model): """Azure VM unmanaged disk input details. All required parameters must be populated in order to send to Azure. - :param disk_uri: Required. The disk Uri. - :type disk_uri: str - :param recovery_azure_storage_account_custom_input: The recovery VHD storage account input. - :type recovery_azure_storage_account_custom_input: + :ivar disk_uri: The disk Uri. Required. + :vartype disk_uri: str + :ivar recovery_azure_storage_account_custom_input: The recovery VHD storage account input. + :vartype recovery_azure_storage_account_custom_input: ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param primary_staging_storage_account_custom_input: The primary staging storage account input. - :type primary_staging_storage_account_custom_input: + :ivar primary_staging_storage_account_custom_input: The primary staging storage account input. + :vartype primary_staging_storage_account_custom_input: ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails """ _validation = { - 'disk_uri': {'required': True}, + "disk_uri": {"required": True}, } _attribute_map = { - 'disk_uri': {'key': 'diskUri', 'type': 'str'}, - 'recovery_azure_storage_account_custom_input': {'key': 'recoveryAzureStorageAccountCustomInput', 'type': 'StorageAccountCustomDetails'}, - 'primary_staging_storage_account_custom_input': {'key': 'primaryStagingStorageAccountCustomInput', 'type': 'StorageAccountCustomDetails'}, + "disk_uri": {"key": "diskUri", "type": "str"}, + "recovery_azure_storage_account_custom_input": { + "key": "recoveryAzureStorageAccountCustomInput", + "type": "StorageAccountCustomDetails", + }, + "primary_staging_storage_account_custom_input": { + "key": "primaryStagingStorageAccountCustomInput", + "type": "StorageAccountCustomDetails", + }, } def __init__( self, *, disk_uri: str, - recovery_azure_storage_account_custom_input: Optional["StorageAccountCustomDetails"] = None, - primary_staging_storage_account_custom_input: Optional["StorageAccountCustomDetails"] = None, - **kwargs - ): - super(A2AProtectionIntentDiskInputDetails, self).__init__(**kwargs) + recovery_azure_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, + primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, + **kwargs + ): + """ + :keyword disk_uri: The disk Uri. Required. + :paramtype disk_uri: str + :keyword recovery_azure_storage_account_custom_input: The recovery VHD storage account input. + :paramtype recovery_azure_storage_account_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :keyword primary_staging_storage_account_custom_input: The primary staging storage account + input. + :paramtype primary_staging_storage_account_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + """ + super().__init__(**kwargs) self.disk_uri = disk_uri self.recovery_azure_storage_account_custom_input = recovery_azure_storage_account_custom_input self.primary_staging_storage_account_custom_input = primary_staging_storage_account_custom_input -class A2AProtectionIntentManagedDiskInputDetails(msrest.serialization.Model): +class A2AProtectionIntentManagedDiskInputDetails(_serialization.Model): """Azure VM managed disk input details. All required parameters must be populated in order to send to Azure. - :param disk_id: Required. The disk Id. - :type disk_id: str - :param primary_staging_storage_account_custom_input: The primary staging storage account input. - :type primary_staging_storage_account_custom_input: + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar primary_staging_storage_account_custom_input: The primary staging storage account input. + :vartype primary_staging_storage_account_custom_input: ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param recovery_resource_group_custom_input: The recovery resource group input. - :type recovery_resource_group_custom_input: + :ivar recovery_resource_group_custom_input: The recovery resource group input. + :vartype recovery_resource_group_custom_input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryResourceGroupCustomDetails - :param recovery_replica_disk_account_type: The replica disk type. Its an optional value and - will be same as source disk type if not user provided. - :type recovery_replica_disk_account_type: str - :param recovery_target_disk_account_type: The target disk type after failover. Its an optional + :ivar recovery_replica_disk_account_type: The replica disk type. Its an optional value and will + be same as source disk type if not user provided. + :vartype recovery_replica_disk_account_type: str + :ivar recovery_target_disk_account_type: The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. - :type recovery_target_disk_account_type: str - :param recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :type recovery_disk_encryption_set_id: str - :param disk_encryption_info: The recovery disk encryption information (for one / single pass + :vartype recovery_target_disk_account_type: str + :ivar recovery_disk_encryption_set_id: The recovery disk encryption set Id. + :vartype recovery_disk_encryption_set_id: str + :ivar disk_encryption_info: The recovery disk encryption information (for one / single pass flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo """ _validation = { - 'disk_id': {'required': True}, + "disk_id": {"required": True}, } _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'primary_staging_storage_account_custom_input': {'key': 'primaryStagingStorageAccountCustomInput', 'type': 'StorageAccountCustomDetails'}, - 'recovery_resource_group_custom_input': {'key': 'recoveryResourceGroupCustomInput', 'type': 'RecoveryResourceGroupCustomDetails'}, - 'recovery_replica_disk_account_type': {'key': 'recoveryReplicaDiskAccountType', 'type': 'str'}, - 'recovery_target_disk_account_type': {'key': 'recoveryTargetDiskAccountType', 'type': 'str'}, - 'recovery_disk_encryption_set_id': {'key': 'recoveryDiskEncryptionSetId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, + "disk_id": {"key": "diskId", "type": "str"}, + "primary_staging_storage_account_custom_input": { + "key": "primaryStagingStorageAccountCustomInput", + "type": "StorageAccountCustomDetails", + }, + "recovery_resource_group_custom_input": { + "key": "recoveryResourceGroupCustomInput", + "type": "RecoveryResourceGroupCustomDetails", + }, + "recovery_replica_disk_account_type": {"key": "recoveryReplicaDiskAccountType", "type": "str"}, + "recovery_target_disk_account_type": {"key": "recoveryTargetDiskAccountType", "type": "str"}, + "recovery_disk_encryption_set_id": {"key": "recoveryDiskEncryptionSetId", "type": "str"}, + "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, } def __init__( self, *, disk_id: str, - primary_staging_storage_account_custom_input: Optional["StorageAccountCustomDetails"] = None, - recovery_resource_group_custom_input: Optional["RecoveryResourceGroupCustomDetails"] = None, + primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, + recovery_resource_group_custom_input: Optional["_models.RecoveryResourceGroupCustomDetails"] = None, recovery_replica_disk_account_type: Optional[str] = None, recovery_target_disk_account_type: Optional[str] = None, recovery_disk_encryption_set_id: Optional[str] = None, - disk_encryption_info: Optional["DiskEncryptionInfo"] = None, - **kwargs - ): - super(A2AProtectionIntentManagedDiskInputDetails, self).__init__(**kwargs) + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, + **kwargs + ): + """ + :keyword disk_id: The disk Id. Required. + :paramtype disk_id: str + :keyword primary_staging_storage_account_custom_input: The primary staging storage account + input. + :paramtype primary_staging_storage_account_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :keyword recovery_resource_group_custom_input: The recovery resource group input. + :paramtype recovery_resource_group_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryResourceGroupCustomDetails + :keyword recovery_replica_disk_account_type: The replica disk type. Its an optional value and + will be same as source disk type if not user provided. + :paramtype recovery_replica_disk_account_type: str + :keyword recovery_target_disk_account_type: The target disk type after failover. Its an + optional value and will be same as source disk type if not user provided. + :paramtype recovery_target_disk_account_type: str + :keyword recovery_disk_encryption_set_id: The recovery disk encryption set Id. + :paramtype recovery_disk_encryption_set_id: str + :keyword disk_encryption_info: The recovery disk encryption information (for one / single pass + flows). + :paramtype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + """ + super().__init__(**kwargs) self.disk_id = disk_id self.primary_staging_storage_account_custom_input = primary_staging_storage_account_custom_input self.recovery_resource_group_custom_input = recovery_resource_group_custom_input @@ -1520,35 +2017,37 @@ def __init__( self.disk_encryption_info = disk_encryption_info -class ProviderSpecificRecoveryPointDetails(msrest.serialization.Model): +class ProviderSpecificRecoveryPointDetails(_serialization.Model): """Replication provider specific recovery point details. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ARecoveryPointDetails, InMageAzureV2RecoveryPointDetails, InMageRcmRecoveryPointDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ARecoveryPointDetails, InMageAzureV2RecoveryPointDetails, InMageRcmRecoveryPointDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the provider type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the provider type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2ARecoveryPointDetails', 'InMageAzureV2': 'InMageAzureV2RecoveryPointDetails', 'InMageRcm': 'InMageRcmRecoveryPointDetails'} + "instance_type": { + "A2A": "A2ARecoveryPointDetails", + "InMageAzureV2": "InMageAzureV2RecoveryPointDetails", + "InMageRcm": "InMageRcmRecoveryPointDetails", + } } - def __init__( - self, - **kwargs - ): - super(ProviderSpecificRecoveryPointDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -1557,68 +2056,72 @@ class A2ARecoveryPointDetails(ProviderSpecificRecoveryPointDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the provider type.Constant filled by server. - :type instance_type: str - :param recovery_point_sync_type: A value indicating whether the recovery point is multi VM - consistent. Possible values include: "MultiVmSyncRecoveryPoint", "PerVmRecoveryPoint". - :type recovery_point_sync_type: str or + :ivar instance_type: Gets the provider type. Required. + :vartype instance_type: str + :ivar recovery_point_sync_type: A value indicating whether the recovery point is multi VM + consistent. Known values are: "MultiVmSyncRecoveryPoint" and "PerVmRecoveryPoint". + :vartype recovery_point_sync_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType - :param disks: List of disk ids representing a recovery point. - :type disks: list[str] + :ivar disks: List of disk ids representing a recovery point. + :vartype disks: list[str] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_sync_type': {'key': 'recoveryPointSyncType', 'type': 'str'}, - 'disks': {'key': 'disks', 'type': '[str]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_sync_type": {"key": "recoveryPointSyncType", "type": "str"}, + "disks": {"key": "disks", "type": "[str]"}, } def __init__( self, *, - recovery_point_sync_type: Optional[Union[str, "RecoveryPointSyncType"]] = None, + recovery_point_sync_type: Optional[Union[str, "_models.RecoveryPointSyncType"]] = None, disks: Optional[List[str]] = None, **kwargs ): - super(A2ARecoveryPointDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword recovery_point_sync_type: A value indicating whether the recovery point is multi VM + consistent. Known values are: "MultiVmSyncRecoveryPoint" and "PerVmRecoveryPoint". + :paramtype recovery_point_sync_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType + :keyword disks: List of disk ids representing a recovery point. + :paramtype disks: list[str] + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.recovery_point_sync_type = recovery_point_sync_type self.disks = disks -class RemoveDisksProviderSpecificInput(msrest.serialization.Model): +class RemoveDisksProviderSpecificInput(_serialization.Model): """Remove Disk provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ARemoveDisksInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ARemoveDisksInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'A2A': 'A2ARemoveDisksInput'} - } + _subtype_map = {"instance_type": {"A2A": "A2ARemoveDisksInput"}} - def __init__( - self, - **kwargs - ): - super(RemoveDisksProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -1627,237 +2130,263 @@ class A2ARemoveDisksInput(RemoveDisksProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param vm_disks_uris: The list of vm disk vhd URIs. - :type vm_disks_uris: list[str] - :param vm_managed_disks_ids: The list of vm managed disk Ids. - :type vm_managed_disks_ids: list[str] + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar vm_disks_uris: The list of vm disk vhd URIs. + :vartype vm_disks_uris: list[str] + :ivar vm_managed_disks_ids: The list of vm managed disk Ids. + :vartype vm_managed_disks_ids: list[str] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_disks_uris': {'key': 'vmDisksUris', 'type': '[str]'}, - 'vm_managed_disks_ids': {'key': 'vmManagedDisksIds', 'type': '[str]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "vm_disks_uris": {"key": "vmDisksUris", "type": "[str]"}, + "vm_managed_disks_ids": {"key": "vmManagedDisksIds", "type": "[str]"}, } def __init__( - self, - *, - vm_disks_uris: Optional[List[str]] = None, - vm_managed_disks_ids: Optional[List[str]] = None, - **kwargs + self, *, vm_disks_uris: Optional[List[str]] = None, vm_managed_disks_ids: Optional[List[str]] = None, **kwargs ): - super(A2ARemoveDisksInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword vm_disks_uris: The list of vm disk vhd URIs. + :paramtype vm_disks_uris: list[str] + :keyword vm_managed_disks_ids: The list of vm managed disk Ids. + :paramtype vm_managed_disks_ids: list[str] + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.vm_disks_uris = vm_disks_uris self.vm_managed_disks_ids = vm_managed_disks_ids -class A2AReplicationDetails(ReplicationProviderSpecificSettings): +class A2AReplicationDetails(ReplicationProviderSpecificSettings): # pylint: disable=too-many-instance-attributes """A2A provider specific settings. 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. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: The fabric specific object Id of the virtual machine. - :type fabric_object_id: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. + :vartype fabric_object_id: str :ivar initial_primary_zone: The initial primary availability zone. :vartype initial_primary_zone: str :ivar initial_primary_fabric_location: The initial primary fabric location. :vartype initial_primary_fabric_location: str :ivar initial_recovery_zone: The initial recovery availability zone. :vartype initial_recovery_zone: str + :ivar initial_primary_extended_location: The initial primary extended location. + :vartype initial_primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar initial_recovery_extended_location: The initial recovery extended location. + :vartype initial_recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation :ivar initial_recovery_fabric_location: The initial recovery fabric location. :vartype initial_recovery_fabric_location: str - :param multi_vm_group_id: The multi vm group Id. - :type multi_vm_group_id: str - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Possible values include: "AutoCreated", "UserSpecified". - :type multi_vm_group_create_option: str or + :ivar multi_vm_group_id: The multi vm group Id. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_group_create_option: Whether Multi VM group is auto created or specified by + user. Known values are: "AutoCreated" and "UserSpecified". + :vartype multi_vm_group_create_option: str or ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :param management_id: The management Id. - :type management_id: str - :param protected_disks: The list of protected disks. - :type protected_disks: + :ivar management_id: The management Id. + :vartype management_id: str + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedDiskDetails] - :param unprotected_disks: The list of unprotected disks. - :type unprotected_disks: + :ivar unprotected_disks: The list of unprotected disks. + :vartype unprotected_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails] - :param protected_managed_disks: The list of protected managed disks. - :type protected_managed_disks: + :ivar protected_managed_disks: The list of protected managed disks. + :vartype protected_managed_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails] - :param recovery_boot_diag_storage_account_id: The recovery boot diagnostic storage account Arm + :ivar recovery_boot_diag_storage_account_id: The recovery boot diagnostic storage account Arm Id. - :type recovery_boot_diag_storage_account_id: str - :param primary_fabric_location: Primary fabric location. - :type primary_fabric_location: str - :param recovery_fabric_location: The recovery fabric location. - :type recovery_fabric_location: str - :param os_type: The type of operating system. - :type os_type: str - :param recovery_azure_vm_size: The size of recovery virtual machine. - :type recovery_azure_vm_size: str - :param recovery_azure_vm_name: The name of recovery virtual machine. - :type recovery_azure_vm_name: str - :param recovery_azure_resource_group_id: The recovery resource group. - :type recovery_azure_resource_group_id: str - :param recovery_cloud_service: The recovery cloud service. - :type recovery_cloud_service: str - :param recovery_availability_set: The recovery availability set. - :type recovery_availability_set: str - :param selected_recovery_azure_network_id: The recovery virtual network. - :type selected_recovery_azure_network_id: str - :param selected_tfo_azure_network_id: The test failover virtual network. - :type selected_tfo_azure_network_id: str - :param vm_nics: The virtual machine nic details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param vm_synced_config_details: The synced configuration details. - :type vm_synced_config_details: + :vartype recovery_boot_diag_storage_account_id: str + :ivar primary_fabric_location: Primary fabric location. + :vartype primary_fabric_location: str + :ivar recovery_fabric_location: The recovery fabric location. + :vartype recovery_fabric_location: str + :ivar os_type: The type of operating system. + :vartype os_type: str + :ivar recovery_azure_vm_size: The size of recovery virtual machine. + :vartype recovery_azure_vm_size: str + :ivar recovery_azure_vm_name: The name of recovery virtual machine. + :vartype recovery_azure_vm_name: str + :ivar recovery_azure_resource_group_id: The recovery resource group. + :vartype recovery_azure_resource_group_id: str + :ivar recovery_cloud_service: The recovery cloud service. + :vartype recovery_cloud_service: str + :ivar recovery_availability_set: The recovery availability set. + :vartype recovery_availability_set: str + :ivar selected_recovery_azure_network_id: The recovery virtual network. + :vartype selected_recovery_azure_network_id: str + :ivar selected_tfo_azure_network_id: The test failover virtual network. + :vartype selected_tfo_azure_network_id: str + :ivar vm_nics: The virtual machine nic details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar vm_synced_config_details: The synced configuration details. + :vartype vm_synced_config_details: ~azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureVmSyncedConfigDetails - :param monitoring_percentage_completion: The percentage of the monitoring job. The type of the + :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. - :type monitoring_percentage_completion: int - :param monitoring_job_type: The type of the monitoring job. The progress is contained in + :vartype monitoring_percentage_completion: int + :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. - :type monitoring_job_type: str - :param last_heartbeat: The last heartbeat received from the source server. - :type last_heartbeat: ~datetime.datetime - :param agent_version: The agent version. - :type agent_version: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param is_replication_agent_update_required: A value indicating whether replication agent - update is required. - :type is_replication_agent_update_required: bool + :vartype monitoring_job_type: str + :ivar last_heartbeat: The last heartbeat received from the source server. + :vartype last_heartbeat: ~datetime.datetime + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar is_replication_agent_update_required: A value indicating whether replication agent update + is required. + :vartype is_replication_agent_update_required: bool :ivar agent_certificate_expiry_date: Agent certificate expiry date. :vartype agent_certificate_expiry_date: ~datetime.datetime - :param is_replication_agent_certificate_update_required: A value indicating whether agent + :ivar is_replication_agent_certificate_update_required: A value indicating whether agent certificate update is required. - :type is_replication_agent_certificate_update_required: bool - :param recovery_fabric_object_id: The recovery fabric object Id. - :type recovery_fabric_object_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param lifecycle_id: An id associated with the PE that survives actions like switch protection + :vartype is_replication_agent_certificate_update_required: bool + :ivar recovery_fabric_object_id: The recovery fabric object Id. + :vartype recovery_fabric_object_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar lifecycle_id: An id associated with the PE that survives actions like switch protection which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to have a link/continuity in being able to have an Id that denotes the "same" protected item even though other internal Ids/ARM Id might be changing. - :type lifecycle_id: str - :param test_failover_recovery_fabric_object_id: The test failover fabric object Id. - :type test_failover_recovery_fabric_object_id: str - :param rpo_in_seconds: The last RPO value in seconds. - :type rpo_in_seconds: long - :param last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by + :vartype lifecycle_id: str + :ivar test_failover_recovery_fabric_object_id: The test failover fabric object Id. + :vartype test_failover_recovery_fabric_object_id: str + :ivar rpo_in_seconds: The last RPO value in seconds. + :vartype rpo_in_seconds: int + :ivar last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by Protection Service. - :type last_rpo_calculated_time: ~datetime.datetime - :param primary_availability_zone: The primary availability zone. - :type primary_availability_zone: str - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - :ivar vm_encryption_type: The encryption type of the VM. Possible values include: - "NotEncrypted", "OnePassEncrypted", "TwoPassEncrypted". + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar primary_availability_zone: The primary availability zone. + :vartype primary_availability_zone: str + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar primary_extended_location: The primary Extended Location. + :vartype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_extended_location: The recovery Extended Location. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar vm_encryption_type: The encryption type of the VM. Known values are: "NotEncrypted", + "OnePassEncrypted", and "TwoPassEncrypted". :vartype vm_encryption_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.VmEncryptionType - :param tfo_azure_vm_name: The test failover vm name. - :type tfo_azure_vm_name: str + :ivar tfo_azure_vm_name: The test failover vm name. + :vartype tfo_azure_vm_name: str :ivar recovery_azure_generation: The recovery azure generation. :vartype recovery_azure_generation: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :type recovery_proximity_placement_group_id: str - :param auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Possible values include: "Disabled", "Enabled". - :type auto_protection_of_data_disk: str or + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :vartype recovery_proximity_placement_group_id: str + :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. + Known values are: "Disabled" and "Enabled". + :vartype auto_protection_of_data_disk: str or ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :param recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set id. - :type recovery_virtual_machine_scale_set_id: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'initial_primary_zone': {'readonly': True}, - 'initial_primary_fabric_location': {'readonly': True}, - 'initial_recovery_zone': {'readonly': True}, - 'initial_recovery_fabric_location': {'readonly': True}, - 'agent_certificate_expiry_date': {'readonly': True}, - 'vm_encryption_type': {'readonly': True}, - 'recovery_azure_generation': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'initial_primary_zone': {'key': 'initialPrimaryZone', 'type': 'str'}, - 'initial_primary_fabric_location': {'key': 'initialPrimaryFabricLocation', 'type': 'str'}, - 'initial_recovery_zone': {'key': 'initialRecoveryZone', 'type': 'str'}, - 'initial_recovery_fabric_location': {'key': 'initialRecoveryFabricLocation', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_group_create_option': {'key': 'multiVmGroupCreateOption', 'type': 'str'}, - 'management_id': {'key': 'managementId', 'type': 'str'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[A2AProtectedDiskDetails]'}, - 'unprotected_disks': {'key': 'unprotectedDisks', 'type': '[A2AUnprotectedDiskDetails]'}, - 'protected_managed_disks': {'key': 'protectedManagedDisks', 'type': '[A2AProtectedManagedDiskDetails]'}, - 'recovery_boot_diag_storage_account_id': {'key': 'recoveryBootDiagStorageAccountId', 'type': 'str'}, - 'primary_fabric_location': {'key': 'primaryFabricLocation', 'type': 'str'}, - 'recovery_fabric_location': {'key': 'recoveryFabricLocation', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'recovery_azure_vm_size': {'key': 'recoveryAzureVMSize', 'type': 'str'}, - 'recovery_azure_vm_name': {'key': 'recoveryAzureVMName', 'type': 'str'}, - 'recovery_azure_resource_group_id': {'key': 'recoveryAzureResourceGroupId', 'type': 'str'}, - 'recovery_cloud_service': {'key': 'recoveryCloudService', 'type': 'str'}, - 'recovery_availability_set': {'key': 'recoveryAvailabilitySet', 'type': 'str'}, - 'selected_recovery_azure_network_id': {'key': 'selectedRecoveryAzureNetworkId', 'type': 'str'}, - 'selected_tfo_azure_network_id': {'key': 'selectedTfoAzureNetworkId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'vm_synced_config_details': {'key': 'vmSyncedConfigDetails', 'type': 'AzureToAzureVmSyncedConfigDetails'}, - 'monitoring_percentage_completion': {'key': 'monitoringPercentageCompletion', 'type': 'int'}, - 'monitoring_job_type': {'key': 'monitoringJobType', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'is_replication_agent_update_required': {'key': 'isReplicationAgentUpdateRequired', 'type': 'bool'}, - 'agent_certificate_expiry_date': {'key': 'agentCertificateExpiryDate', 'type': 'iso-8601'}, - 'is_replication_agent_certificate_update_required': {'key': 'isReplicationAgentCertificateUpdateRequired', 'type': 'bool'}, - 'recovery_fabric_object_id': {'key': 'recoveryFabricObjectId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'lifecycle_id': {'key': 'lifecycleId', 'type': 'str'}, - 'test_failover_recovery_fabric_object_id': {'key': 'testFailoverRecoveryFabricObjectId', 'type': 'str'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'primary_availability_zone': {'key': 'primaryAvailabilityZone', 'type': 'str'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, - 'vm_encryption_type': {'key': 'vmEncryptionType', 'type': 'str'}, - 'tfo_azure_vm_name': {'key': 'tfoAzureVMName', 'type': 'str'}, - 'recovery_azure_generation': {'key': 'recoveryAzureGeneration', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, - 'auto_protection_of_data_disk': {'key': 'autoProtectionOfDataDisk', 'type': 'str'}, - 'recovery_virtual_machine_scale_set_id': {'key': 'recoveryVirtualMachineScaleSetId', 'type': 'str'}, - } - - def __init__( + :ivar recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set id. + :vartype recovery_virtual_machine_scale_set_id: str + :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :vartype recovery_capacity_reservation_group_id: str + """ + + _validation = { + "instance_type": {"required": True}, + "initial_primary_zone": {"readonly": True}, + "initial_primary_fabric_location": {"readonly": True}, + "initial_recovery_zone": {"readonly": True}, + "initial_recovery_fabric_location": {"readonly": True}, + "agent_certificate_expiry_date": {"readonly": True}, + "vm_encryption_type": {"readonly": True}, + "recovery_azure_generation": {"readonly": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "initial_primary_zone": {"key": "initialPrimaryZone", "type": "str"}, + "initial_primary_fabric_location": {"key": "initialPrimaryFabricLocation", "type": "str"}, + "initial_recovery_zone": {"key": "initialRecoveryZone", "type": "str"}, + "initial_primary_extended_location": {"key": "initialPrimaryExtendedLocation", "type": "ExtendedLocation"}, + "initial_recovery_extended_location": {"key": "initialRecoveryExtendedLocation", "type": "ExtendedLocation"}, + "initial_recovery_fabric_location": {"key": "initialRecoveryFabricLocation", "type": "str"}, + "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "multi_vm_group_create_option": {"key": "multiVmGroupCreateOption", "type": "str"}, + "management_id": {"key": "managementId", "type": "str"}, + "protected_disks": {"key": "protectedDisks", "type": "[A2AProtectedDiskDetails]"}, + "unprotected_disks": {"key": "unprotectedDisks", "type": "[A2AUnprotectedDiskDetails]"}, + "protected_managed_disks": {"key": "protectedManagedDisks", "type": "[A2AProtectedManagedDiskDetails]"}, + "recovery_boot_diag_storage_account_id": {"key": "recoveryBootDiagStorageAccountId", "type": "str"}, + "primary_fabric_location": {"key": "primaryFabricLocation", "type": "str"}, + "recovery_fabric_location": {"key": "recoveryFabricLocation", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "recovery_azure_vm_size": {"key": "recoveryAzureVMSize", "type": "str"}, + "recovery_azure_vm_name": {"key": "recoveryAzureVMName", "type": "str"}, + "recovery_azure_resource_group_id": {"key": "recoveryAzureResourceGroupId", "type": "str"}, + "recovery_cloud_service": {"key": "recoveryCloudService", "type": "str"}, + "recovery_availability_set": {"key": "recoveryAvailabilitySet", "type": "str"}, + "selected_recovery_azure_network_id": {"key": "selectedRecoveryAzureNetworkId", "type": "str"}, + "selected_tfo_azure_network_id": {"key": "selectedTfoAzureNetworkId", "type": "str"}, + "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, + "vm_synced_config_details": {"key": "vmSyncedConfigDetails", "type": "AzureToAzureVmSyncedConfigDetails"}, + "monitoring_percentage_completion": {"key": "monitoringPercentageCompletion", "type": "int"}, + "monitoring_job_type": {"key": "monitoringJobType", "type": "str"}, + "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, + "agent_version": {"key": "agentVersion", "type": "str"}, + "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, + "is_replication_agent_update_required": {"key": "isReplicationAgentUpdateRequired", "type": "bool"}, + "agent_certificate_expiry_date": {"key": "agentCertificateExpiryDate", "type": "iso-8601"}, + "is_replication_agent_certificate_update_required": { + "key": "isReplicationAgentCertificateUpdateRequired", + "type": "bool", + }, + "recovery_fabric_object_id": {"key": "recoveryFabricObjectId", "type": "str"}, + "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, + "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, + "lifecycle_id": {"key": "lifecycleId", "type": "str"}, + "test_failover_recovery_fabric_object_id": {"key": "testFailoverRecoveryFabricObjectId", "type": "str"}, + "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, + "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, + "primary_availability_zone": {"key": "primaryAvailabilityZone", "type": "str"}, + "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, + "primary_extended_location": {"key": "primaryExtendedLocation", "type": "ExtendedLocation"}, + "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, + "vm_encryption_type": {"key": "vmEncryptionType", "type": "str"}, + "tfo_azure_vm_name": {"key": "tfoAzureVMName", "type": "str"}, + "recovery_azure_generation": {"key": "recoveryAzureGeneration", "type": "str"}, + "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, + "auto_protection_of_data_disk": {"key": "autoProtectionOfDataDisk", "type": "str"}, + "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, + "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, fabric_object_id: Optional[str] = None, + initial_primary_extended_location: Optional["_models.ExtendedLocation"] = None, + initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = None, multi_vm_group_id: Optional[str] = None, multi_vm_group_name: Optional[str] = None, - multi_vm_group_create_option: Optional[Union[str, "MultiVmGroupCreateOption"]] = None, + multi_vm_group_create_option: Optional[Union[str, "_models.MultiVmGroupCreateOption"]] = None, management_id: Optional[str] = None, - protected_disks: Optional[List["A2AProtectedDiskDetails"]] = None, - unprotected_disks: Optional[List["A2AUnprotectedDiskDetails"]] = None, - protected_managed_disks: Optional[List["A2AProtectedManagedDiskDetails"]] = None, + protected_disks: Optional[List["_models.A2AProtectedDiskDetails"]] = None, + unprotected_disks: Optional[List["_models.A2AUnprotectedDiskDetails"]] = None, + protected_managed_disks: Optional[List["_models.A2AProtectedManagedDiskDetails"]] = None, recovery_boot_diag_storage_account_id: Optional[str] = None, primary_fabric_location: Optional[str] = None, recovery_fabric_location: Optional[str] = None, @@ -1869,8 +2398,8 @@ def __init__( recovery_availability_set: Optional[str] = None, selected_recovery_azure_network_id: Optional[str] = None, selected_tfo_azure_network_id: Optional[str] = None, - vm_nics: Optional[List["VMNicDetails"]] = None, - vm_synced_config_details: Optional["AzureToAzureVmSyncedConfigDetails"] = None, + vm_nics: Optional[List["_models.VMNicDetails"]] = None, + vm_synced_config_details: Optional["_models.AzureToAzureVmSyncedConfigDetails"] = None, monitoring_percentage_completion: Optional[int] = None, monitoring_job_type: Optional[str] = None, last_heartbeat: Optional[datetime.datetime] = None, @@ -1887,18 +2416,138 @@ def __init__( last_rpo_calculated_time: Optional[datetime.datetime] = None, primary_availability_zone: Optional[str] = None, recovery_availability_zone: Optional[str] = None, + primary_extended_location: Optional["_models.ExtendedLocation"] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = None, tfo_azure_vm_name: Optional[str] = None, recovery_proximity_placement_group_id: Optional[str] = None, - auto_protection_of_data_disk: Optional[Union[str, "AutoProtectionOfDataDisk"]] = None, + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, recovery_virtual_machine_scale_set_id: Optional[str] = None, - **kwargs - ): - super(A2AReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + recovery_capacity_reservation_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword fabric_object_id: The fabric specific object Id of the virtual machine. + :paramtype fabric_object_id: str + :keyword initial_primary_extended_location: The initial primary extended location. + :paramtype initial_primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :keyword initial_recovery_extended_location: The initial recovery extended location. + :paramtype initial_recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :keyword multi_vm_group_id: The multi vm group Id. + :paramtype multi_vm_group_id: str + :keyword multi_vm_group_name: The multi vm group name. + :paramtype multi_vm_group_name: str + :keyword multi_vm_group_create_option: Whether Multi VM group is auto created or specified by + user. Known values are: "AutoCreated" and "UserSpecified". + :paramtype multi_vm_group_create_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption + :keyword management_id: The management Id. + :paramtype management_id: str + :keyword protected_disks: The list of protected disks. + :paramtype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedDiskDetails] + :keyword unprotected_disks: The list of unprotected disks. + :paramtype unprotected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails] + :keyword protected_managed_disks: The list of protected managed disks. + :paramtype protected_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails] + :keyword recovery_boot_diag_storage_account_id: The recovery boot diagnostic storage account + Arm Id. + :paramtype recovery_boot_diag_storage_account_id: str + :keyword primary_fabric_location: Primary fabric location. + :paramtype primary_fabric_location: str + :keyword recovery_fabric_location: The recovery fabric location. + :paramtype recovery_fabric_location: str + :keyword os_type: The type of operating system. + :paramtype os_type: str + :keyword recovery_azure_vm_size: The size of recovery virtual machine. + :paramtype recovery_azure_vm_size: str + :keyword recovery_azure_vm_name: The name of recovery virtual machine. + :paramtype recovery_azure_vm_name: str + :keyword recovery_azure_resource_group_id: The recovery resource group. + :paramtype recovery_azure_resource_group_id: str + :keyword recovery_cloud_service: The recovery cloud service. + :paramtype recovery_cloud_service: str + :keyword recovery_availability_set: The recovery availability set. + :paramtype recovery_availability_set: str + :keyword selected_recovery_azure_network_id: The recovery virtual network. + :paramtype selected_recovery_azure_network_id: str + :keyword selected_tfo_azure_network_id: The test failover virtual network. + :paramtype selected_tfo_azure_network_id: str + :keyword vm_nics: The virtual machine nic details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :keyword vm_synced_config_details: The synced configuration details. + :paramtype vm_synced_config_details: + ~azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureVmSyncedConfigDetails + :keyword monitoring_percentage_completion: The percentage of the monitoring job. The type of + the monitoring job is defined by MonitoringJobType property. + :paramtype monitoring_percentage_completion: int + :keyword monitoring_job_type: The type of the monitoring job. The progress is contained in + MonitoringPercentageCompletion property. + :paramtype monitoring_job_type: str + :keyword last_heartbeat: The last heartbeat received from the source server. + :paramtype last_heartbeat: ~datetime.datetime + :keyword agent_version: The agent version. + :paramtype agent_version: str + :keyword agent_expiry_date: Agent expiry date. + :paramtype agent_expiry_date: ~datetime.datetime + :keyword is_replication_agent_update_required: A value indicating whether replication agent + update is required. + :paramtype is_replication_agent_update_required: bool + :keyword is_replication_agent_certificate_update_required: A value indicating whether agent + certificate update is required. + :paramtype is_replication_agent_certificate_update_required: bool + :keyword recovery_fabric_object_id: The recovery fabric object Id. + :paramtype recovery_fabric_object_id: str + :keyword vm_protection_state: The protection state for the vm. + :paramtype vm_protection_state: str + :keyword vm_protection_state_description: The protection state description for the vm. + :paramtype vm_protection_state_description: str + :keyword lifecycle_id: An id associated with the PE that survives actions like switch + protection which change the backing PE/CPE objects internally.The lifecycle id gets carried + forward to have a link/continuity in being able to have an Id that denotes the "same" protected + item even though other internal Ids/ARM Id might be changing. + :paramtype lifecycle_id: str + :keyword test_failover_recovery_fabric_object_id: The test failover fabric object Id. + :paramtype test_failover_recovery_fabric_object_id: str + :keyword rpo_in_seconds: The last RPO value in seconds. + :paramtype rpo_in_seconds: int + :keyword last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by + Protection Service. + :paramtype last_rpo_calculated_time: ~datetime.datetime + :keyword primary_availability_zone: The primary availability zone. + :paramtype primary_availability_zone: str + :keyword recovery_availability_zone: The recovery availability zone. + :paramtype recovery_availability_zone: str + :keyword primary_extended_location: The primary Extended Location. + :paramtype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :keyword recovery_extended_location: The recovery Extended Location. + :paramtype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :keyword tfo_azure_vm_name: The test failover vm name. + :paramtype tfo_azure_vm_name: str + :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :paramtype recovery_proximity_placement_group_id: str + :keyword auto_protection_of_data_disk: A value indicating whether the auto protection is + enabled. Known values are: "Disabled" and "Enabled". + :paramtype auto_protection_of_data_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk + :keyword recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set id. + :paramtype recovery_virtual_machine_scale_set_id: str + :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :paramtype recovery_capacity_reservation_group_id: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.fabric_object_id = fabric_object_id self.initial_primary_zone = None self.initial_primary_fabric_location = None self.initial_recovery_zone = None + self.initial_primary_extended_location = initial_primary_extended_location + self.initial_recovery_extended_location = initial_recovery_extended_location self.initial_recovery_fabric_location = None self.multi_vm_group_id = multi_vm_group_id self.multi_vm_group_name = multi_vm_group_name @@ -1937,131 +2586,155 @@ def __init__( self.last_rpo_calculated_time = last_rpo_calculated_time self.primary_availability_zone = primary_availability_zone self.recovery_availability_zone = recovery_availability_zone + self.primary_extended_location = primary_extended_location + self.recovery_extended_location = recovery_extended_location self.vm_encryption_type = None self.tfo_azure_vm_name = tfo_azure_vm_name self.recovery_azure_generation = None self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id self.auto_protection_of_data_disk = auto_protection_of_data_disk self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id + self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id -class ReplicationProtectionIntentProviderSpecificSettings(msrest.serialization.Model): +class ReplicationProtectionIntentProviderSpecificSettings(_serialization.Model): """Replication provider specific settings. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AReplicationIntentDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AReplicationIntentDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'A2A': 'A2AReplicationIntentDetails'} - } + _subtype_map = {"instance_type": {"A2A": "A2AReplicationIntentDetails"}} - def __init__( - self, - **kwargs - ): - super(ReplicationProtectionIntentProviderSpecificSettings, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class A2AReplicationIntentDetails(ReplicationProtectionIntentProviderSpecificSettings): +class A2AReplicationIntentDetails( + ReplicationProtectionIntentProviderSpecificSettings +): # pylint: disable=too-many-instance-attributes """A2A provider specific settings. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param fabric_object_id: The fabric specific object Id of the virtual machine. - :type fabric_object_id: str - :param primary_location: The primary location for the virtual machine. - :type primary_location: str - :param recovery_location: The recovery location for the virtual machine. - :type recovery_location: str - :param recovery_subscription_id: The recovery subscription Id of the virtual machine. - :type recovery_subscription_id: str - :param vm_disks: The list of vm disk details. - :type vm_disks: + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. + :vartype fabric_object_id: str + :ivar primary_location: The primary location for the virtual machine. + :vartype primary_location: str + :ivar recovery_location: The recovery location for the virtual machine. + :vartype recovery_location: str + :ivar recovery_subscription_id: The recovery subscription Id of the virtual machine. + :vartype recovery_subscription_id: str + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk details. - :type vm_managed_disks: + :ivar vm_managed_disks: The list of vm managed disk details. + :vartype vm_managed_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] - :param recovery_resource_group_id: The recovery resource group id. - :type recovery_resource_group_id: str - :param protection_profile: The protection profile custom details. - :type protection_profile: + :ivar recovery_resource_group_id: The recovery resource group id. + :vartype recovery_resource_group_id: str + :ivar protection_profile: The protection profile custom details. + :vartype protection_profile: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails - :param primary_staging_storage_account: The primary staging storage account details. - :type primary_staging_storage_account: + :ivar primary_staging_storage_account: The primary staging storage account details. + :vartype primary_staging_storage_account: ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param recovery_availability_set: The recovery availability set details. - :type recovery_availability_set: + :ivar recovery_availability_set: The recovery availability set details. + :vartype recovery_availability_set: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails - :param recovery_virtual_network: The recovery virtual network details. - :type recovery_virtual_network: + :ivar recovery_virtual_network: The recovery virtual network details. + :vartype recovery_virtual_network: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails - :param recovery_proximity_placement_group: The recovery proximity placement group custom + :ivar recovery_proximity_placement_group: The recovery proximity placement group custom details. - :type recovery_proximity_placement_group: + :vartype recovery_proximity_placement_group: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails - :param auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Possible values include: "Disabled", "Enabled". - :type auto_protection_of_data_disk: str or + :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. + Known values are: "Disabled" and "Enabled". + :vartype auto_protection_of_data_disk: str or ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_group_id: The multi vm group id. - :type multi_vm_group_id: str - :param recovery_boot_diag_storage_account: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account: + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_group_id: The multi vm group id. + :vartype multi_vm_group_id: str + :ivar recovery_boot_diag_storage_account: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account: ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :param disk_encryption_info: The recovery disk encryption information (for two pass flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - :param recovery_availability_type: Required. The recovery availability type of the virtual - machine. - :type recovery_availability_type: str - """ - - _validation = { - 'instance_type': {'required': True}, - 'recovery_availability_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'primary_location': {'key': 'primaryLocation', 'type': 'str'}, - 'recovery_location': {'key': 'recoveryLocation', 'type': 'str'}, - 'recovery_subscription_id': {'key': 'recoverySubscriptionId', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AProtectionIntentDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AProtectionIntentManagedDiskInputDetails]'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'protection_profile': {'key': 'protectionProfile', 'type': 'ProtectionProfileCustomDetails'}, - 'primary_staging_storage_account': {'key': 'primaryStagingStorageAccount', 'type': 'StorageAccountCustomDetails'}, - 'recovery_availability_set': {'key': 'recoveryAvailabilitySet', 'type': 'RecoveryAvailabilitySetCustomDetails'}, - 'recovery_virtual_network': {'key': 'recoveryVirtualNetwork', 'type': 'RecoveryVirtualNetworkCustomDetails'}, - 'recovery_proximity_placement_group': {'key': 'recoveryProximityPlacementGroup', 'type': 'RecoveryProximityPlacementGroupCustomDetails'}, - 'auto_protection_of_data_disk': {'key': 'autoProtectionOfDataDisk', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'recovery_boot_diag_storage_account': {'key': 'recoveryBootDiagStorageAccount', 'type': 'StorageAccountCustomDetails'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, - 'recovery_availability_type': {'key': 'recoveryAvailabilityType', 'type': 'str'}, + :ivar disk_encryption_info: The recovery disk encryption information (for two pass flows). + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar recovery_availability_type: The recovery availability type of the virtual machine. + Required. + :vartype recovery_availability_type: str + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + :ivar automation_account_authentication_type: A value indicating the type authentication to use + for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + """ + + _validation = { + "instance_type": {"required": True}, + "recovery_availability_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "primary_location": {"key": "primaryLocation", "type": "str"}, + "recovery_location": {"key": "recoveryLocation", "type": "str"}, + "recovery_subscription_id": {"key": "recoverySubscriptionId", "type": "str"}, + "vm_disks": {"key": "vmDisks", "type": "[A2AProtectionIntentDiskInputDetails]"}, + "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AProtectionIntentManagedDiskInputDetails]"}, + "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, + "protection_profile": {"key": "protectionProfile", "type": "ProtectionProfileCustomDetails"}, + "primary_staging_storage_account": { + "key": "primaryStagingStorageAccount", + "type": "StorageAccountCustomDetails", + }, + "recovery_availability_set": {"key": "recoveryAvailabilitySet", "type": "RecoveryAvailabilitySetCustomDetails"}, + "recovery_virtual_network": {"key": "recoveryVirtualNetwork", "type": "RecoveryVirtualNetworkCustomDetails"}, + "recovery_proximity_placement_group": { + "key": "recoveryProximityPlacementGroup", + "type": "RecoveryProximityPlacementGroupCustomDetails", + }, + "auto_protection_of_data_disk": {"key": "autoProtectionOfDataDisk", "type": "str"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, + "recovery_boot_diag_storage_account": { + "key": "recoveryBootDiagStorageAccount", + "type": "StorageAccountCustomDetails", + }, + "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, + "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, + "recovery_availability_type": {"key": "recoveryAvailabilityType", "type": "str"}, + "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, + "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, + "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, } def __init__( @@ -2072,24 +2745,92 @@ def __init__( primary_location: Optional[str] = None, recovery_location: Optional[str] = None, recovery_subscription_id: Optional[str] = None, - vm_disks: Optional[List["A2AProtectionIntentDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["A2AProtectionIntentManagedDiskInputDetails"]] = None, + vm_disks: Optional[List["_models.A2AProtectionIntentDiskInputDetails"]] = None, + vm_managed_disks: Optional[List["_models.A2AProtectionIntentManagedDiskInputDetails"]] = None, recovery_resource_group_id: Optional[str] = None, - protection_profile: Optional["ProtectionProfileCustomDetails"] = None, - primary_staging_storage_account: Optional["StorageAccountCustomDetails"] = None, - recovery_availability_set: Optional["RecoveryAvailabilitySetCustomDetails"] = None, - recovery_virtual_network: Optional["RecoveryVirtualNetworkCustomDetails"] = None, - recovery_proximity_placement_group: Optional["RecoveryProximityPlacementGroupCustomDetails"] = None, - auto_protection_of_data_disk: Optional[Union[str, "AutoProtectionOfDataDisk"]] = None, + protection_profile: Optional["_models.ProtectionProfileCustomDetails"] = None, + primary_staging_storage_account: Optional["_models.StorageAccountCustomDetails"] = None, + recovery_availability_set: Optional["_models.RecoveryAvailabilitySetCustomDetails"] = None, + recovery_virtual_network: Optional["_models.RecoveryVirtualNetworkCustomDetails"] = None, + recovery_proximity_placement_group: Optional["_models.RecoveryProximityPlacementGroupCustomDetails"] = None, + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, multi_vm_group_name: Optional[str] = None, multi_vm_group_id: Optional[str] = None, - recovery_boot_diag_storage_account: Optional["StorageAccountCustomDetails"] = None, - disk_encryption_info: Optional["DiskEncryptionInfo"] = None, + recovery_boot_diag_storage_account: Optional["_models.StorageAccountCustomDetails"] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, recovery_availability_zone: Optional[str] = None, - **kwargs - ): - super(A2AReplicationIntentDetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, + automation_account_arm_id: Optional[str] = None, + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = None, + **kwargs + ): + """ + :keyword fabric_object_id: The fabric specific object Id of the virtual machine. + :paramtype fabric_object_id: str + :keyword primary_location: The primary location for the virtual machine. + :paramtype primary_location: str + :keyword recovery_location: The recovery location for the virtual machine. + :paramtype recovery_location: str + :keyword recovery_subscription_id: The recovery subscription Id of the virtual machine. + :paramtype recovery_subscription_id: str + :keyword vm_disks: The list of vm disk details. + :paramtype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] + :keyword vm_managed_disks: The list of vm managed disk details. + :paramtype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] + :keyword recovery_resource_group_id: The recovery resource group id. + :paramtype recovery_resource_group_id: str + :keyword protection_profile: The protection profile custom details. + :paramtype protection_profile: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails + :keyword primary_staging_storage_account: The primary staging storage account details. + :paramtype primary_staging_storage_account: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :keyword recovery_availability_set: The recovery availability set details. + :paramtype recovery_availability_set: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails + :keyword recovery_virtual_network: The recovery virtual network details. + :paramtype recovery_virtual_network: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails + :keyword recovery_proximity_placement_group: The recovery proximity placement group custom + details. + :paramtype recovery_proximity_placement_group: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails + :keyword auto_protection_of_data_disk: A value indicating whether the auto protection is + enabled. Known values are: "Disabled" and "Enabled". + :paramtype auto_protection_of_data_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk + :keyword multi_vm_group_name: The multi vm group name. + :paramtype multi_vm_group_name: str + :keyword multi_vm_group_id: The multi vm group id. + :paramtype multi_vm_group_id: str + :keyword recovery_boot_diag_storage_account: The boot diagnostic storage account. + :paramtype recovery_boot_diag_storage_account: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :keyword disk_encryption_info: The recovery disk encryption information (for two pass flows). + :paramtype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :keyword recovery_availability_zone: The recovery availability zone. + :paramtype recovery_availability_zone: str + :keyword recovery_availability_type: The recovery availability type of the virtual machine. + Required. + :paramtype recovery_availability_type: str + :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :paramtype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :keyword automation_account_arm_id: The automation account arm id. + :paramtype automation_account_arm_id: str + :keyword automation_account_authentication_type: A value indicating the type authentication to + use for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :paramtype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.fabric_object_id = fabric_object_id self.primary_location = primary_location self.recovery_location = recovery_location @@ -2109,37 +2850,46 @@ def __init__( self.disk_encryption_info = disk_encryption_info self.recovery_availability_zone = recovery_availability_zone self.recovery_availability_type = recovery_availability_type + self.agent_auto_update_status = agent_auto_update_status + self.automation_account_arm_id = automation_account_arm_id + self.automation_account_authentication_type = automation_account_authentication_type -class ReverseReplicationProviderSpecificInput(msrest.serialization.Model): +class ReverseReplicationProviderSpecificInput(_serialization.Model): """Provider specific reverse replication input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AReprotectInput, HyperVReplicaAzureReprotectInput, InMageReprotectInput, InMageAzureV2ReprotectInput, InMageRcmReprotectInput, InMageRcmFailbackReprotectInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AReprotectInput, HyperVReplicaAzureReprotectInput, InMageReprotectInput, + InMageAzureV2ReprotectInput, InMageRcmReprotectInput, InMageRcmFailbackReprotectInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AReprotectInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureReprotectInput', 'InMage': 'InMageReprotectInput', 'InMageAzureV2': 'InMageAzureV2ReprotectInput', 'InMageRcm': 'InMageRcmReprotectInput', 'InMageRcmFailback': 'InMageRcmFailbackReprotectInput'} - } - - def __init__( - self, - **kwargs - ): - super(ReverseReplicationProviderSpecificInput, self).__init__(**kwargs) + "instance_type": { + "A2A": "A2AReprotectInput", + "HyperVReplicaAzure": "HyperVReplicaAzureReprotectInput", + "InMage": "InMageReprotectInput", + "InMageAzureV2": "InMageAzureV2ReprotectInput", + "InMageRcm": "InMageRcmReprotectInput", + "InMageRcmFailback": "InMageRcmFailbackReprotectInput", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -2148,49 +2898,64 @@ class A2AReprotectInput(ReverseReplicationProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str - :param vm_disks: The list of vm disk details. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :param recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :type recovery_resource_group_id: str - :param recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :type recovery_cloud_service_id: str - :param recovery_availability_set_id: The recovery availability set. - :type recovery_availability_set_id: str - :param policy_id: The Policy Id. - :type policy_id: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :vartype recovery_resource_group_id: str + :ivar recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. + :vartype recovery_cloud_service_id: str + :ivar recovery_availability_set_id: The recovery availability set. + :vartype recovery_availability_set_id: str + :ivar policy_id: The Policy Id. + :vartype policy_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AVmDiskInputDetails]'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_cloud_service_id': {'key': 'recoveryCloudServiceId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, + "vm_disks": {"key": "vmDisks", "type": "[A2AVmDiskInputDetails]"}, + "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, + "recovery_cloud_service_id": {"key": "recoveryCloudServiceId", "type": "str"}, + "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, } def __init__( self, *, recovery_container_id: Optional[str] = None, - vm_disks: Optional[List["A2AVmDiskInputDetails"]] = None, + vm_disks: Optional[List["_models.A2AVmDiskInputDetails"]] = None, recovery_resource_group_id: Optional[str] = None, recovery_cloud_service_id: Optional[str] = None, recovery_availability_set_id: Optional[str] = None, policy_id: Optional[str] = None, **kwargs ): - super(A2AReprotectInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword recovery_container_id: The recovery container Id. + :paramtype recovery_container_id: str + :keyword vm_disks: The list of vm disk details. + :paramtype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :paramtype recovery_resource_group_id: str + :keyword recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. + :paramtype recovery_cloud_service_id: str + :keyword recovery_availability_set_id: The recovery availability set. + :paramtype recovery_availability_set_id: str + :keyword policy_id: The Policy Id. + :paramtype policy_id: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.recovery_container_id = recovery_container_id self.vm_disks = vm_disks self.recovery_resource_group_id = recovery_resource_group_id @@ -2199,98 +2964,98 @@ def __init__( self.policy_id = policy_id -class SwitchProtectionProviderSpecificInput(msrest.serialization.Model): +class SwitchProtectionProviderSpecificInput(_serialization.Model): """Provider specific switch protection input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ASwitchProtectionInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ASwitchProtectionInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'A2A': 'A2ASwitchProtectionInput'} - } + _subtype_map = {"instance_type": {"A2A": "A2ASwitchProtectionInput"}} - def __init__( - self, - **kwargs - ): - super(SwitchProtectionProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class A2ASwitchProtectionInput(SwitchProtectionProviderSpecificInput): +class A2ASwitchProtectionInput(SwitchProtectionProviderSpecificInput): # pylint: disable=too-many-instance-attributes """A2A specific switch protection input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str - :param vm_disks: The list of vm disk details. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :param vm_managed_disks: The list of vm managed disk details. - :type vm_managed_disks: + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :ivar vm_managed_disks: The list of vm managed disk details. + :vartype vm_managed_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :param recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :type recovery_resource_group_id: str - :param recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :type recovery_cloud_service_id: str - :param recovery_availability_set_id: The recovery availability set. - :type recovery_availability_set_id: str - :param policy_id: The Policy Id. - :type policy_id: str - :param recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account_id: str - :param recovery_availability_zone: The recovery availability zone. - :type recovery_availability_zone: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :type recovery_proximity_placement_group_id: str - :param recovery_virtual_machine_scale_set_id: The virtual machine scale set id. - :type recovery_virtual_machine_scale_set_id: str - :param disk_encryption_info: The recovery disk encryption information. - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[A2AVmDiskInputDetails]'}, - 'vm_managed_disks': {'key': 'vmManagedDisks', 'type': '[A2AVmManagedDiskInputDetails]'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_cloud_service_id': {'key': 'recoveryCloudServiceId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'recovery_boot_diag_storage_account_id': {'key': 'recoveryBootDiagStorageAccountId', 'type': 'str'}, - 'recovery_availability_zone': {'key': 'recoveryAvailabilityZone', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, - 'recovery_virtual_machine_scale_set_id': {'key': 'recoveryVirtualMachineScaleSetId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :vartype recovery_resource_group_id: str + :ivar recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. + :vartype recovery_cloud_service_id: str + :ivar recovery_availability_set_id: The recovery availability set. + :vartype recovery_availability_set_id: str + :ivar policy_id: The Policy Id. + :vartype policy_id: str + :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account_id: str + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :vartype recovery_proximity_placement_group_id: str + :ivar recovery_virtual_machine_scale_set_id: The virtual machine scale set id. + :vartype recovery_virtual_machine_scale_set_id: str + :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :vartype recovery_capacity_reservation_group_id: str + :ivar disk_encryption_info: The recovery disk encryption information. + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, + "vm_disks": {"key": "vmDisks", "type": "[A2AVmDiskInputDetails]"}, + "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AVmManagedDiskInputDetails]"}, + "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, + "recovery_cloud_service_id": {"key": "recoveryCloudServiceId", "type": "str"}, + "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "recovery_boot_diag_storage_account_id": {"key": "recoveryBootDiagStorageAccountId", "type": "str"}, + "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, + "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, + "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, + "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, + "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, } def __init__( self, *, recovery_container_id: Optional[str] = None, - vm_disks: Optional[List["A2AVmDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["A2AVmManagedDiskInputDetails"]] = None, + vm_disks: Optional[List["_models.A2AVmDiskInputDetails"]] = None, + vm_managed_disks: Optional[List["_models.A2AVmManagedDiskInputDetails"]] = None, recovery_resource_group_id: Optional[str] = None, recovery_cloud_service_id: Optional[str] = None, recovery_availability_set_id: Optional[str] = None, @@ -2299,11 +3064,43 @@ def __init__( recovery_availability_zone: Optional[str] = None, recovery_proximity_placement_group_id: Optional[str] = None, recovery_virtual_machine_scale_set_id: Optional[str] = None, - disk_encryption_info: Optional["DiskEncryptionInfo"] = None, - **kwargs - ): - super(A2ASwitchProtectionInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + recovery_capacity_reservation_group_id: Optional[str] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, + **kwargs + ): + """ + :keyword recovery_container_id: The recovery container Id. + :paramtype recovery_container_id: str + :keyword vm_disks: The list of vm disk details. + :paramtype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :keyword vm_managed_disks: The list of vm managed disk details. + :paramtype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] + :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :paramtype recovery_resource_group_id: str + :keyword recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. + :paramtype recovery_cloud_service_id: str + :keyword recovery_availability_set_id: The recovery availability set. + :paramtype recovery_availability_set_id: str + :keyword policy_id: The Policy Id. + :paramtype policy_id: str + :keyword recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :paramtype recovery_boot_diag_storage_account_id: str + :keyword recovery_availability_zone: The recovery availability zone. + :paramtype recovery_availability_zone: str + :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :paramtype recovery_proximity_placement_group_id: str + :keyword recovery_virtual_machine_scale_set_id: The virtual machine scale set id. + :paramtype recovery_virtual_machine_scale_set_id: str + :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :paramtype recovery_capacity_reservation_group_id: str + :keyword disk_encryption_info: The recovery disk encryption information. + :paramtype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.recovery_container_id = recovery_container_id self.vm_disks = vm_disks self.vm_managed_disks = vm_managed_disks @@ -2315,38 +3112,44 @@ def __init__( self.recovery_availability_zone = recovery_availability_zone self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id + self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id self.disk_encryption_info = disk_encryption_info -class TestFailoverProviderSpecificInput(msrest.serialization.Model): +class TestFailoverProviderSpecificInput(_serialization.Model): """Provider specific test failover input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2ATestFailoverInput, HyperVReplicaAzureTestFailoverInput, InMageTestFailoverInput, InMageAzureV2TestFailoverInput, InMageRcmTestFailoverInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ATestFailoverInput, HyperVReplicaAzureTestFailoverInput, InMageTestFailoverInput, + InMageAzureV2TestFailoverInput, InMageRcmTestFailoverInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2ATestFailoverInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureTestFailoverInput', 'InMage': 'InMageTestFailoverInput', 'InMageAzureV2': 'InMageAzureV2TestFailoverInput', 'InMageRcm': 'InMageRcmTestFailoverInput'} - } - - def __init__( - self, - **kwargs - ): - super(TestFailoverProviderSpecificInput, self).__init__(**kwargs) + "instance_type": { + "A2A": "A2ATestFailoverInput", + "HyperVReplicaAzure": "HyperVReplicaAzureTestFailoverInput", + "InMage": "InMageTestFailoverInput", + "InMageAzureV2": "InMageAzureV2TestFailoverInput", + "InMageRcm": "InMageRcmTestFailoverInput", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -2355,68 +3158,78 @@ class A2ATestFailoverInput(TestFailoverProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: The recovery point id to be passed to test failover to a particular + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - :param cloud_service_creation_option: A value indicating whether to use recovery cloud service + :vartype recovery_point_id: str + :ivar cloud_service_creation_option: A value indicating whether to use recovery cloud service for TFO or not. - :type cloud_service_creation_option: str + :vartype cloud_service_creation_option: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'cloud_service_creation_option': {'key': 'cloudServiceCreationOption', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "cloud_service_creation_option": {"key": "cloudServiceCreationOption", "type": "str"}, } def __init__( - self, - *, - recovery_point_id: Optional[str] = None, - cloud_service_creation_option: Optional[str] = None, - **kwargs + self, *, recovery_point_id: Optional[str] = None, cloud_service_creation_option: Optional[str] = None, **kwargs ): - super(A2ATestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + :keyword cloud_service_creation_option: A value indicating whether to use recovery cloud + service for TFO or not. + :paramtype cloud_service_creation_option: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.recovery_point_id = recovery_point_id self.cloud_service_creation_option = cloud_service_creation_option -class UnplannedFailoverProviderSpecificInput(msrest.serialization.Model): +class UnplannedFailoverProviderSpecificInput(_serialization.Model): """Provider specific unplanned failover input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AUnplannedFailoverInput, HyperVReplicaAzureUnplannedFailoverInput, InMageUnplannedFailoverInput, InMageAzureV2UnplannedFailoverInput, InMageRcmUnplannedFailoverInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AUnplannedFailoverInput, HyperVReplicaAzureUnplannedFailoverInput, + InMageUnplannedFailoverInput, InMageAzureV2UnplannedFailoverInput, + InMageRcmUnplannedFailoverInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AUnplannedFailoverInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureUnplannedFailoverInput', 'InMage': 'InMageUnplannedFailoverInput', 'InMageAzureV2': 'InMageAzureV2UnplannedFailoverInput', 'InMageRcm': 'InMageRcmUnplannedFailoverInput'} - } - - def __init__( - self, - **kwargs - ): - super(UnplannedFailoverProviderSpecificInput, self).__init__(**kwargs) + "instance_type": { + "A2A": "A2AUnplannedFailoverInput", + "HyperVReplicaAzure": "HyperVReplicaAzureUnplannedFailoverInput", + "InMage": "InMageUnplannedFailoverInput", + "InMageAzureV2": "InMageAzureV2UnplannedFailoverInput", + "InMageRcm": "InMageRcmUnplannedFailoverInput", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -2425,96 +3238,106 @@ class A2AUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str - :param cloud_service_creation_option: A value indicating whether to use recovery cloud service + :vartype recovery_point_id: str + :ivar cloud_service_creation_option: A value indicating whether to use recovery cloud service for failover or not. - :type cloud_service_creation_option: str + :vartype cloud_service_creation_option: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'cloud_service_creation_option': {'key': 'cloudServiceCreationOption', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "cloud_service_creation_option": {"key": "cloudServiceCreationOption", "type": "str"}, } def __init__( - self, - *, - recovery_point_id: Optional[str] = None, - cloud_service_creation_option: Optional[str] = None, - **kwargs + self, *, recovery_point_id: Optional[str] = None, cloud_service_creation_option: Optional[str] = None, **kwargs ): - super(A2AUnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + """ + :keyword recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + :keyword cloud_service_creation_option: A value indicating whether to use recovery cloud + service for failover or not. + :paramtype cloud_service_creation_option: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.recovery_point_id = recovery_point_id self.cloud_service_creation_option = cloud_service_creation_option -class A2AUnprotectedDiskDetails(msrest.serialization.Model): +class A2AUnprotectedDiskDetails(_serialization.Model): """A2A unprotected disk details. - :param disk_lun_id: The source lun Id for the data disk. - :type disk_lun_id: int - :param disk_auto_protection_status: A value indicating whether the disk auto protection is - enabled. Possible values include: "Disabled", "Enabled". - :type disk_auto_protection_status: str or + :ivar disk_lun_id: The source lun Id for the data disk. + :vartype disk_lun_id: int + :ivar disk_auto_protection_status: A value indicating whether the disk auto protection is + enabled. Known values are: "Disabled" and "Enabled". + :vartype disk_auto_protection_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk """ _attribute_map = { - 'disk_lun_id': {'key': 'diskLunId', 'type': 'int'}, - 'disk_auto_protection_status': {'key': 'diskAutoProtectionStatus', 'type': 'str'}, + "disk_lun_id": {"key": "diskLunId", "type": "int"}, + "disk_auto_protection_status": {"key": "diskAutoProtectionStatus", "type": "str"}, } def __init__( self, *, disk_lun_id: Optional[int] = None, - disk_auto_protection_status: Optional[Union[str, "AutoProtectionOfDataDisk"]] = None, - **kwargs - ): - super(A2AUnprotectedDiskDetails, self).__init__(**kwargs) + disk_auto_protection_status: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, + **kwargs + ): + """ + :keyword disk_lun_id: The source lun Id for the data disk. + :paramtype disk_lun_id: int + :keyword disk_auto_protection_status: A value indicating whether the disk auto protection is + enabled. Known values are: "Disabled" and "Enabled". + :paramtype disk_auto_protection_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk + """ + super().__init__(**kwargs) self.disk_lun_id = disk_lun_id self.disk_auto_protection_status = disk_auto_protection_status -class ReplicationProviderSpecificUpdateContainerMappingInput(msrest.serialization.Model): +class ReplicationProviderSpecificUpdateContainerMappingInput(_serialization.Model): """Provider specific input for update pairing operations. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AUpdateContainerMappingInput, InMageRcmUpdateContainerMappingInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AUpdateContainerMappingInput, InMageRcmUpdateContainerMappingInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AUpdateContainerMappingInput', 'InMageRcm': 'InMageRcmUpdateContainerMappingInput'} + "instance_type": {"A2A": "A2AUpdateContainerMappingInput", "InMageRcm": "InMageRcmUpdateContainerMappingInput"} } - def __init__( - self, - **kwargs - ): - super(ReplicationProviderSpecificUpdateContainerMappingInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -2523,68 +3346,93 @@ class A2AUpdateContainerMappingInput(ReplicationProviderSpecificUpdateContainerM All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param agent_auto_update_status: A value indicating whether the auto update is enabled. - Possible values include: "Disabled", "Enabled". - :type agent_auto_update_status: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :param automation_account_arm_id: The automation account arm id. - :type automation_account_arm_id: str + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + :ivar automation_account_authentication_type: A value indicating the type authentication to use + for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'agent_auto_update_status': {'key': 'agentAutoUpdateStatus', 'type': 'str'}, - 'automation_account_arm_id': {'key': 'automationAccountArmId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, + "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, + "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, } def __init__( self, *, - agent_auto_update_status: Optional[Union[str, "AgentAutoUpdateStatus"]] = None, + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, automation_account_arm_id: Optional[str] = None, - **kwargs - ): - super(A2AUpdateContainerMappingInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = None, + **kwargs + ): + """ + :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :paramtype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :keyword automation_account_arm_id: The automation account arm id. + :paramtype automation_account_arm_id: str + :keyword automation_account_authentication_type: A value indicating the type authentication to + use for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :paramtype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.agent_auto_update_status = agent_auto_update_status self.automation_account_arm_id = automation_account_arm_id + self.automation_account_authentication_type = automation_account_authentication_type -class UpdateReplicationProtectedItemProviderInput(msrest.serialization.Model): +class UpdateReplicationProtectedItemProviderInput(_serialization.Model): """Update replication protected item provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: A2AUpdateReplicationProtectedItemInput, HyperVReplicaAzureUpdateReplicationProtectedItemInput, InMageAzureV2UpdateReplicationProtectedItemInput, InMageRcmUpdateReplicationProtectedItemInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AUpdateReplicationProtectedItemInput, HyperVReplicaAzureUpdateReplicationProtectedItemInput, + InMageAzureV2UpdateReplicationProtectedItemInput, InMageRcmUpdateReplicationProtectedItemInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'A2AUpdateReplicationProtectedItemInput', 'HyperVReplicaAzure': 'HyperVReplicaAzureUpdateReplicationProtectedItemInput', 'InMageAzureV2': 'InMageAzureV2UpdateReplicationProtectedItemInput', 'InMageRcm': 'InMageRcmUpdateReplicationProtectedItemInput'} + "instance_type": { + "A2A": "A2AUpdateReplicationProtectedItemInput", + "HyperVReplicaAzure": "HyperVReplicaAzureUpdateReplicationProtectedItemInput", + "InMageAzureV2": "InMageAzureV2UpdateReplicationProtectedItemInput", + "InMageRcm": "InMageRcmUpdateReplicationProtectedItemInput", + } } - def __init__( - self, - **kwargs - ): - super(UpdateReplicationProtectedItemProviderInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -2593,41 +3441,45 @@ class A2AUpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProvi All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_cloud_service_id: The target cloud service ARM Id (for V1). - :type recovery_cloud_service_id: str - :param recovery_resource_group_id: The target resource group ARM Id (for V2). - :type recovery_resource_group_id: str - :param managed_disk_update_details: Managed disk update details. - :type managed_disk_update_details: + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_cloud_service_id: The target cloud service ARM Id (for V1). + :vartype recovery_cloud_service_id: str + :ivar recovery_resource_group_id: The target resource group ARM Id (for V2). + :vartype recovery_resource_group_id: str + :ivar managed_disk_update_details: Managed disk update details. + :vartype managed_disk_update_details: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskUpdateDetails] - :param recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :type recovery_boot_diag_storage_account_id: str - :param disk_encryption_info: The recovery os disk encryption information. - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param tfo_azure_vm_name: The user given name for Test Failover VM. - :type tfo_azure_vm_name: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :type recovery_proximity_placement_group_id: str - :param recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set Id. - :type recovery_virtual_machine_scale_set_id: str + :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account_id: str + :ivar disk_encryption_info: The recovery os disk encryption information. + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar tfo_azure_vm_name: The user given name for Test Failover VM. + :vartype tfo_azure_vm_name: str + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :vartype recovery_proximity_placement_group_id: str + :ivar recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set Id. + :vartype recovery_virtual_machine_scale_set_id: str + :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :vartype recovery_capacity_reservation_group_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_cloud_service_id': {'key': 'recoveryCloudServiceId', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'managed_disk_update_details': {'key': 'managedDiskUpdateDetails', 'type': '[A2AVmManagedDiskUpdateDetails]'}, - 'recovery_boot_diag_storage_account_id': {'key': 'recoveryBootDiagStorageAccountId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'tfo_azure_vm_name': {'key': 'tfoAzureVMName', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, - 'recovery_virtual_machine_scale_set_id': {'key': 'recoveryVirtualMachineScaleSetId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_cloud_service_id": {"key": "recoveryCloudServiceId", "type": "str"}, + "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, + "managed_disk_update_details": {"key": "managedDiskUpdateDetails", "type": "[A2AVmManagedDiskUpdateDetails]"}, + "recovery_boot_diag_storage_account_id": {"key": "recoveryBootDiagStorageAccountId", "type": "str"}, + "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, + "tfo_azure_vm_name": {"key": "tfoAzureVMName", "type": "str"}, + "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, + "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, + "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, } def __init__( @@ -2635,16 +3487,39 @@ def __init__( *, recovery_cloud_service_id: Optional[str] = None, recovery_resource_group_id: Optional[str] = None, - managed_disk_update_details: Optional[List["A2AVmManagedDiskUpdateDetails"]] = None, + managed_disk_update_details: Optional[List["_models.A2AVmManagedDiskUpdateDetails"]] = None, recovery_boot_diag_storage_account_id: Optional[str] = None, - disk_encryption_info: Optional["DiskEncryptionInfo"] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, tfo_azure_vm_name: Optional[str] = None, recovery_proximity_placement_group_id: Optional[str] = None, recovery_virtual_machine_scale_set_id: Optional[str] = None, - **kwargs - ): - super(A2AUpdateReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + recovery_capacity_reservation_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword recovery_cloud_service_id: The target cloud service ARM Id (for V1). + :paramtype recovery_cloud_service_id: str + :keyword recovery_resource_group_id: The target resource group ARM Id (for V2). + :paramtype recovery_resource_group_id: str + :keyword managed_disk_update_details: Managed disk update details. + :paramtype managed_disk_update_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskUpdateDetails] + :keyword recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :paramtype recovery_boot_diag_storage_account_id: str + :keyword disk_encryption_info: The recovery os disk encryption information. + :paramtype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :keyword tfo_azure_vm_name: The user given name for Test Failover VM. + :paramtype tfo_azure_vm_name: str + :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :paramtype recovery_proximity_placement_group_id: str + :keyword recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set Id. + :paramtype recovery_virtual_machine_scale_set_id: str + :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :paramtype recovery_capacity_reservation_group_id: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.recovery_cloud_service_id = recovery_cloud_service_id self.recovery_resource_group_id = recovery_resource_group_id self.managed_disk_update_details = managed_disk_update_details @@ -2653,32 +3528,33 @@ def __init__( self.tfo_azure_vm_name = tfo_azure_vm_name self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id + self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id -class A2AVmDiskInputDetails(msrest.serialization.Model): +class A2AVmDiskInputDetails(_serialization.Model): """A2A disk input details. All required parameters must be populated in order to send to Azure. - :param disk_uri: Required. The disk Uri. - :type disk_uri: str - :param recovery_azure_storage_account_id: Required. The recovery VHD storage account Id. - :type recovery_azure_storage_account_id: str - :param primary_staging_azure_storage_account_id: Required. The primary staging storage account - Id. - :type primary_staging_azure_storage_account_id: str + :ivar disk_uri: The disk Uri. Required. + :vartype disk_uri: str + :ivar recovery_azure_storage_account_id: The recovery VHD storage account Id. Required. + :vartype recovery_azure_storage_account_id: str + :ivar primary_staging_azure_storage_account_id: The primary staging storage account Id. + Required. + :vartype primary_staging_azure_storage_account_id: str """ _validation = { - 'disk_uri': {'required': True}, - 'recovery_azure_storage_account_id': {'required': True}, - 'primary_staging_azure_storage_account_id': {'required': True}, + "disk_uri": {"required": True}, + "recovery_azure_storage_account_id": {"required": True}, + "primary_staging_azure_storage_account_id": {"required": True}, } _attribute_map = { - 'disk_uri': {'key': 'diskUri', 'type': 'str'}, - 'recovery_azure_storage_account_id': {'key': 'recoveryAzureStorageAccountId', 'type': 'str'}, - 'primary_staging_azure_storage_account_id': {'key': 'primaryStagingAzureStorageAccountId', 'type': 'str'}, + "disk_uri": {"key": "diskUri", "type": "str"}, + "recovery_azure_storage_account_id": {"key": "recoveryAzureStorageAccountId", "type": "str"}, + "primary_staging_azure_storage_account_id": {"key": "primaryStagingAzureStorageAccountId", "type": "str"}, } def __init__( @@ -2689,51 +3565,61 @@ def __init__( primary_staging_azure_storage_account_id: str, **kwargs ): - super(A2AVmDiskInputDetails, self).__init__(**kwargs) + """ + :keyword disk_uri: The disk Uri. Required. + :paramtype disk_uri: str + :keyword recovery_azure_storage_account_id: The recovery VHD storage account Id. Required. + :paramtype recovery_azure_storage_account_id: str + :keyword primary_staging_azure_storage_account_id: The primary staging storage account Id. + Required. + :paramtype primary_staging_azure_storage_account_id: str + """ + super().__init__(**kwargs) self.disk_uri = disk_uri self.recovery_azure_storage_account_id = recovery_azure_storage_account_id self.primary_staging_azure_storage_account_id = primary_staging_azure_storage_account_id -class A2AVmManagedDiskInputDetails(msrest.serialization.Model): +class A2AVmManagedDiskInputDetails(_serialization.Model): """A2A managed disk input details. All required parameters must be populated in order to send to Azure. - :param disk_id: Required. The disk Id. - :type disk_id: str - :param primary_staging_azure_storage_account_id: Required. The primary staging storage account - Arm Id. - :type primary_staging_azure_storage_account_id: str - :param recovery_resource_group_id: Required. The target resource group Arm Id. - :type recovery_resource_group_id: str - :param recovery_replica_disk_account_type: The replica disk type. Its an optional value and - will be same as source disk type if not user provided. - :type recovery_replica_disk_account_type: str - :param recovery_target_disk_account_type: The target disk type after failover. Its an optional + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar primary_staging_azure_storage_account_id: The primary staging storage account Arm Id. + Required. + :vartype primary_staging_azure_storage_account_id: str + :ivar recovery_resource_group_id: The target resource group Arm Id. Required. + :vartype recovery_resource_group_id: str + :ivar recovery_replica_disk_account_type: The replica disk type. Its an optional value and will + be same as source disk type if not user provided. + :vartype recovery_replica_disk_account_type: str + :ivar recovery_target_disk_account_type: The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. - :type recovery_target_disk_account_type: str - :param recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :type recovery_disk_encryption_set_id: str - :param disk_encryption_info: The recovery disk encryption information (for one / single pass + :vartype recovery_target_disk_account_type: str + :ivar recovery_disk_encryption_set_id: The recovery disk encryption set Id. + :vartype recovery_disk_encryption_set_id: str + :ivar disk_encryption_info: The recovery disk encryption information (for one / single pass flows). - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo """ _validation = { - 'disk_id': {'required': True}, - 'primary_staging_azure_storage_account_id': {'required': True}, - 'recovery_resource_group_id': {'required': True}, + "disk_id": {"required": True}, + "primary_staging_azure_storage_account_id": {"required": True}, + "recovery_resource_group_id": {"required": True}, } _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'primary_staging_azure_storage_account_id': {'key': 'primaryStagingAzureStorageAccountId', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, - 'recovery_replica_disk_account_type': {'key': 'recoveryReplicaDiskAccountType', 'type': 'str'}, - 'recovery_target_disk_account_type': {'key': 'recoveryTargetDiskAccountType', 'type': 'str'}, - 'recovery_disk_encryption_set_id': {'key': 'recoveryDiskEncryptionSetId', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, + "disk_id": {"key": "diskId", "type": "str"}, + "primary_staging_azure_storage_account_id": {"key": "primaryStagingAzureStorageAccountId", "type": "str"}, + "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, + "recovery_replica_disk_account_type": {"key": "recoveryReplicaDiskAccountType", "type": "str"}, + "recovery_target_disk_account_type": {"key": "recoveryTargetDiskAccountType", "type": "str"}, + "recovery_disk_encryption_set_id": {"key": "recoveryDiskEncryptionSetId", "type": "str"}, + "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, } def __init__( @@ -2745,10 +3631,31 @@ def __init__( recovery_replica_disk_account_type: Optional[str] = None, recovery_target_disk_account_type: Optional[str] = None, recovery_disk_encryption_set_id: Optional[str] = None, - disk_encryption_info: Optional["DiskEncryptionInfo"] = None, - **kwargs - ): - super(A2AVmManagedDiskInputDetails, self).__init__(**kwargs) + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, + **kwargs + ): + """ + :keyword disk_id: The disk Id. Required. + :paramtype disk_id: str + :keyword primary_staging_azure_storage_account_id: The primary staging storage account Arm Id. + Required. + :paramtype primary_staging_azure_storage_account_id: str + :keyword recovery_resource_group_id: The target resource group Arm Id. Required. + :paramtype recovery_resource_group_id: str + :keyword recovery_replica_disk_account_type: The replica disk type. Its an optional value and + will be same as source disk type if not user provided. + :paramtype recovery_replica_disk_account_type: str + :keyword recovery_target_disk_account_type: The target disk type after failover. Its an + optional value and will be same as source disk type if not user provided. + :paramtype recovery_target_disk_account_type: str + :keyword recovery_disk_encryption_set_id: The recovery disk encryption set Id. + :paramtype recovery_disk_encryption_set_id: str + :keyword disk_encryption_info: The recovery disk encryption information (for one / single pass + flows). + :paramtype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + """ + super().__init__(**kwargs) self.disk_id = disk_id self.primary_staging_azure_storage_account_id = primary_staging_azure_storage_account_id self.recovery_resource_group_id = recovery_resource_group_id @@ -2758,30 +3665,31 @@ def __init__( self.disk_encryption_info = disk_encryption_info -class A2AVmManagedDiskUpdateDetails(msrest.serialization.Model): +class A2AVmManagedDiskUpdateDetails(_serialization.Model): """A2A Vm managed disk update details. - :param disk_id: The disk Id. - :type disk_id: str - :param recovery_target_disk_account_type: The target disk type before failover. - :type recovery_target_disk_account_type: str - :param recovery_replica_disk_account_type: The replica disk type before failover. - :type recovery_replica_disk_account_type: str - :param disk_encryption_info: The recovery os disk encryption information. - :type disk_encryption_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :param failover_disk_name: The target disk name for unplanned failover operation. - :type failover_disk_name: str - :param tfo_disk_name: The target disk name for test failover operation. - :type tfo_disk_name: str + :ivar disk_id: The disk Id. + :vartype disk_id: str + :ivar recovery_target_disk_account_type: The target disk type before failover. + :vartype recovery_target_disk_account_type: str + :ivar recovery_replica_disk_account_type: The replica disk type before failover. + :vartype recovery_replica_disk_account_type: str + :ivar disk_encryption_info: The recovery os disk encryption information. + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar failover_disk_name: The target disk name for unplanned failover operation. + :vartype failover_disk_name: str + :ivar tfo_disk_name: The target disk name for test failover operation. + :vartype tfo_disk_name: str """ _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'recovery_target_disk_account_type': {'key': 'recoveryTargetDiskAccountType', 'type': 'str'}, - 'recovery_replica_disk_account_type': {'key': 'recoveryReplicaDiskAccountType', 'type': 'str'}, - 'disk_encryption_info': {'key': 'diskEncryptionInfo', 'type': 'DiskEncryptionInfo'}, - 'failover_disk_name': {'key': 'failoverDiskName', 'type': 'str'}, - 'tfo_disk_name': {'key': 'tfoDiskName', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "recovery_target_disk_account_type": {"key": "recoveryTargetDiskAccountType", "type": "str"}, + "recovery_replica_disk_account_type": {"key": "recoveryReplicaDiskAccountType", "type": "str"}, + "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, + "failover_disk_name": {"key": "failoverDiskName", "type": "str"}, + "tfo_disk_name": {"key": "tfoDiskName", "type": "str"}, } def __init__( @@ -2790,12 +3698,27 @@ def __init__( disk_id: Optional[str] = None, recovery_target_disk_account_type: Optional[str] = None, recovery_replica_disk_account_type: Optional[str] = None, - disk_encryption_info: Optional["DiskEncryptionInfo"] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, failover_disk_name: Optional[str] = None, tfo_disk_name: Optional[str] = None, **kwargs ): - super(A2AVmManagedDiskUpdateDetails, self).__init__(**kwargs) + """ + :keyword disk_id: The disk Id. + :paramtype disk_id: str + :keyword recovery_target_disk_account_type: The target disk type before failover. + :paramtype recovery_target_disk_account_type: str + :keyword recovery_replica_disk_account_type: The replica disk type before failover. + :paramtype recovery_replica_disk_account_type: str + :keyword disk_encryption_info: The recovery os disk encryption information. + :paramtype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :keyword failover_disk_name: The target disk name for unplanned failover operation. + :paramtype failover_disk_name: str + :keyword tfo_disk_name: The target disk name for test failover operation. + :paramtype tfo_disk_name: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.recovery_target_disk_account_type = recovery_target_disk_account_type self.recovery_replica_disk_account_type = recovery_replica_disk_account_type @@ -2804,163 +3727,187 @@ def __init__( self.tfo_disk_name = tfo_disk_name -class A2AZoneDetails(msrest.serialization.Model): +class A2AZoneDetails(_serialization.Model): """Zone details data. - :param source: Source zone info. - :type source: str - :param target: The target zone info. - :type target: str + :ivar source: Source zone info. + :vartype source: str + :ivar target: The target zone info. + :vartype target: str """ _attribute_map = { - 'source': {'key': 'source', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, + "source": {"key": "source", "type": "str"}, + "target": {"key": "target", "type": "str"}, } - def __init__( - self, - *, - source: Optional[str] = None, - target: Optional[str] = None, - **kwargs - ): - super(A2AZoneDetails, self).__init__(**kwargs) + def __init__(self, *, source: Optional[str] = None, target: Optional[str] = None, **kwargs): + """ + :keyword source: Source zone info. + :paramtype source: str + :keyword target: The target zone info. + :paramtype target: str + """ + super().__init__(**kwargs) self.source = source self.target = target -class AddDisksInput(msrest.serialization.Model): +class AddDisksInput(_serialization.Model): """Input for add disk(s) operation. - :param properties: Add disks input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInputProperties + :ivar properties: Add disks input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'AddDisksInputProperties'}, + "properties": {"key": "properties", "type": "AddDisksInputProperties"}, } - def __init__( - self, - *, - properties: Optional["AddDisksInputProperties"] = None, - **kwargs - ): - super(AddDisksInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.AddDisksInputProperties"] = None, **kwargs): + """ + :keyword properties: Add disks input properties. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class AddDisksInputProperties(msrest.serialization.Model): +class AddDisksInputProperties(_serialization.Model): """Add Disks input properties. All required parameters must be populated in order to send to Azure. - :param provider_specific_details: Required. The ReplicationProviderInput. For - HyperVReplicaAzure provider, it will be AzureEnableProtectionInput object. For San provider, it - will be SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :type provider_specific_details: + :ivar provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure provider, + it will be AzureEnableProtectionInput object. For San provider, it will be + SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. Required. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput """ _validation = { - 'provider_specific_details': {'required': True}, + "provider_specific_details": {"required": True}, } _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'AddDisksProviderSpecificInput'}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "AddDisksProviderSpecificInput"}, } - def __init__( - self, - *, - provider_specific_details: "AddDisksProviderSpecificInput", - **kwargs - ): - super(AddDisksInputProperties, self).__init__(**kwargs) + def __init__(self, *, provider_specific_details: "_models.AddDisksProviderSpecificInput", **kwargs): + """ + :keyword provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure + provider, it will be AzureEnableProtectionInput object. For San provider, it will be + SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. Required. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput + """ + super().__init__(**kwargs) self.provider_specific_details = provider_specific_details -class AddRecoveryServicesProviderInput(msrest.serialization.Model): +class AddRecoveryServicesProviderInput(_serialization.Model): """Input required to add a provider. All required parameters must be populated in order to send to Azure. - :param properties: Required. The properties of an add provider request. - :type properties: + :ivar properties: The properties of an add provider request. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'AddRecoveryServicesProviderInputProperties'}, + "properties": {"key": "properties", "type": "AddRecoveryServicesProviderInputProperties"}, } - def __init__( - self, - *, - properties: "AddRecoveryServicesProviderInputProperties", - **kwargs - ): - super(AddRecoveryServicesProviderInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.AddRecoveryServicesProviderInputProperties", **kwargs): + """ + :keyword properties: The properties of an add provider request. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class AddRecoveryServicesProviderInputProperties(msrest.serialization.Model): +class AddRecoveryServicesProviderInputProperties(_serialization.Model): """The properties of an add provider request. All required parameters must be populated in order to send to Azure. - :param machine_name: Required. The name of the machine where the provider is getting added. - :type machine_name: str - :param machine_id: The Id of the machine where the provider is getting added. - :type machine_id: str - :param bios_id: The Bios Id of the machine. - :type bios_id: str - :param authentication_identity_input: Required. The identity provider input for DRA - authentication. - :type authentication_identity_input: + :ivar machine_name: The name of the machine where the provider is getting added. Required. + :vartype machine_name: str + :ivar machine_id: The Id of the machine where the provider is getting added. + :vartype machine_id: str + :ivar bios_id: The Bios Id of the machine. + :vartype bios_id: str + :ivar authentication_identity_input: The identity provider input for DRA authentication. + Required. + :vartype authentication_identity_input: ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - :param resource_access_identity_input: Required. The identity provider input for resource - access. - :type resource_access_identity_input: + :ivar resource_access_identity_input: The identity provider input for resource access. + Required. + :vartype resource_access_identity_input: ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - :param data_plane_authentication_identity_input: The identity provider input for data plane + :ivar data_plane_authentication_identity_input: The identity provider input for data plane authentication. - :type data_plane_authentication_identity_input: + :vartype data_plane_authentication_identity_input: ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput """ _validation = { - 'machine_name': {'required': True}, - 'authentication_identity_input': {'required': True}, - 'resource_access_identity_input': {'required': True}, + "machine_name": {"required": True}, + "authentication_identity_input": {"required": True}, + "resource_access_identity_input": {"required": True}, } _attribute_map = { - 'machine_name': {'key': 'machineName', 'type': 'str'}, - 'machine_id': {'key': 'machineId', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'authentication_identity_input': {'key': 'authenticationIdentityInput', 'type': 'IdentityProviderInput'}, - 'resource_access_identity_input': {'key': 'resourceAccessIdentityInput', 'type': 'IdentityProviderInput'}, - 'data_plane_authentication_identity_input': {'key': 'dataPlaneAuthenticationIdentityInput', 'type': 'IdentityProviderInput'}, + "machine_name": {"key": "machineName", "type": "str"}, + "machine_id": {"key": "machineId", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "authentication_identity_input": {"key": "authenticationIdentityInput", "type": "IdentityProviderInput"}, + "resource_access_identity_input": {"key": "resourceAccessIdentityInput", "type": "IdentityProviderInput"}, + "data_plane_authentication_identity_input": { + "key": "dataPlaneAuthenticationIdentityInput", + "type": "IdentityProviderInput", + }, } def __init__( self, *, machine_name: str, - authentication_identity_input: "IdentityProviderInput", - resource_access_identity_input: "IdentityProviderInput", + authentication_identity_input: "_models.IdentityProviderInput", + resource_access_identity_input: "_models.IdentityProviderInput", machine_id: Optional[str] = None, bios_id: Optional[str] = None, - data_plane_authentication_identity_input: Optional["IdentityProviderInput"] = None, - **kwargs - ): - super(AddRecoveryServicesProviderInputProperties, self).__init__(**kwargs) + data_plane_authentication_identity_input: Optional["_models.IdentityProviderInput"] = None, + **kwargs + ): + """ + :keyword machine_name: The name of the machine where the provider is getting added. Required. + :paramtype machine_name: str + :keyword machine_id: The Id of the machine where the provider is getting added. + :paramtype machine_id: str + :keyword bios_id: The Bios Id of the machine. + :paramtype bios_id: str + :keyword authentication_identity_input: The identity provider input for DRA authentication. + Required. + :paramtype authentication_identity_input: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput + :keyword resource_access_identity_input: The identity provider input for resource access. + Required. + :paramtype resource_access_identity_input: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput + :keyword data_plane_authentication_identity_input: The identity provider input for data plane + authentication. + :paramtype data_plane_authentication_identity_input: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput + """ + super().__init__(**kwargs) self.machine_name = machine_name self.machine_id = machine_id self.bios_id = bios_id @@ -2969,48 +3916,49 @@ def __init__( self.data_plane_authentication_identity_input = data_plane_authentication_identity_input -class AddVCenterRequest(msrest.serialization.Model): +class AddVCenterRequest(_serialization.Model): """Input required to add vCenter. - :param properties: The properties of an add vCenter request. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequestProperties + :ivar properties: The properties of an add vCenter request. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequestProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'AddVCenterRequestProperties'}, + "properties": {"key": "properties", "type": "AddVCenterRequestProperties"}, } - def __init__( - self, - *, - properties: Optional["AddVCenterRequestProperties"] = None, - **kwargs - ): - super(AddVCenterRequest, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.AddVCenterRequestProperties"] = None, **kwargs): + """ + :keyword properties: The properties of an add vCenter request. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequestProperties + """ + super().__init__(**kwargs) self.properties = properties -class AddVCenterRequestProperties(msrest.serialization.Model): +class AddVCenterRequestProperties(_serialization.Model): """The properties of an add vCenter request. - :param friendly_name: The friendly name of the vCenter. - :type friendly_name: str - :param ip_address: The IP address of the vCenter to be discovered. - :type ip_address: str - :param process_server_id: The process server Id from where the discovery is orchestrated. - :type process_server_id: str - :param port: The port number for discovery. - :type port: str - :param run_as_account_id: The account Id which has privileges to discover the vCenter. - :type run_as_account_id: str + :ivar friendly_name: The friendly name of the vCenter. + :vartype friendly_name: str + :ivar ip_address: The IP address of the vCenter to be discovered. + :vartype ip_address: str + :ivar process_server_id: The process server Id from where the discovery is orchestrated. + :vartype process_server_id: str + :ivar port: The port number for discovery. + :vartype port: str + :ivar run_as_account_id: The account Id which has privileges to discover the vCenter. + :vartype run_as_account_id: str """ _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "port": {"key": "port", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, } def __init__( @@ -3023,7 +3971,19 @@ def __init__( run_as_account_id: Optional[str] = None, **kwargs ): - super(AddVCenterRequestProperties, self).__init__(**kwargs) + """ + :keyword friendly_name: The friendly name of the vCenter. + :paramtype friendly_name: str + :keyword ip_address: The IP address of the vCenter to be discovered. + :paramtype ip_address: str + :keyword process_server_id: The process server Id from where the discovery is orchestrated. + :paramtype process_server_id: str + :keyword port: The port number for discovery. + :paramtype port: str + :keyword run_as_account_id: The account Id which has privileges to discover the vCenter. + :paramtype run_as_account_id: str + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.ip_address = ip_address self.process_server_id = process_server_id @@ -3031,7 +3991,7 @@ def __init__( self.run_as_account_id = run_as_account_id -class AgentDetails(msrest.serialization.Model): +class AgentDetails(_serialization.Model): """Agent details. Variables are only populated by the server, and will be ignored when sending a request. @@ -3049,26 +4009,24 @@ class AgentDetails(msrest.serialization.Model): """ _validation = { - 'agent_id': {'readonly': True}, - 'machine_id': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'disks': {'readonly': True}, + "agent_id": {"readonly": True}, + "machine_id": {"readonly": True}, + "bios_id": {"readonly": True}, + "fqdn": {"readonly": True}, + "disks": {"readonly": True}, } _attribute_map = { - 'agent_id': {'key': 'agentId', 'type': 'str'}, - 'machine_id': {'key': 'machineId', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'disks': {'key': 'disks', 'type': '[AgentDiskDetails]'}, + "agent_id": {"key": "agentId", "type": "str"}, + "machine_id": {"key": "machineId", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "disks": {"key": "disks", "type": "[AgentDiskDetails]"}, } - def __init__( - self, - **kwargs - ): - super(AgentDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.agent_id = None self.machine_id = None self.bios_id = None @@ -3076,7 +4034,7 @@ def __init__( self.disks = None -class AgentDiskDetails(msrest.serialization.Model): +class AgentDiskDetails(_serialization.Model): """Agent disk details. Variables are only populated by the server, and will be ignored when sending a request. @@ -3088,32 +4046,30 @@ class AgentDiskDetails(msrest.serialization.Model): :ivar is_os_disk: A value indicating whether the disk is the OS disk. :vartype is_os_disk: str :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: long + :vartype capacity_in_bytes: int :ivar lun_id: The lun of disk. :vartype lun_id: int """ _validation = { - 'disk_id': {'readonly': True}, - 'disk_name': {'readonly': True}, - 'is_os_disk': {'readonly': True}, - 'capacity_in_bytes': {'readonly': True}, - 'lun_id': {'readonly': True}, + "disk_id": {"readonly": True}, + "disk_name": {"readonly": True}, + "is_os_disk": {"readonly": True}, + "capacity_in_bytes": {"readonly": True}, + "lun_id": {"readonly": True}, } _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'lun_id': {'key': 'lunId', 'type': 'int'}, + "disk_id": {"key": "diskId", "type": "str"}, + "disk_name": {"key": "diskName", "type": "str"}, + "is_os_disk": {"key": "isOSDisk", "type": "str"}, + "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, + "lun_id": {"key": "lunId", "type": "int"}, } - def __init__( - self, - **kwargs - ): - super(AgentDiskDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.disk_id = None self.disk_name = None self.is_os_disk = None @@ -3121,7 +4077,7 @@ def __init__( self.lun_id = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """Azure resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -3132,30 +4088,29 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str + :ivar location: Resource Location. + :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: Optional[str] = None, - **kwargs - ): - super(Resource, self).__init__(**kwargs) + def __init__(self, *, location: Optional[str] = None, **kwargs): + """ + :keyword location: Resource Location. + :paramtype location: str + """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3173,78 +4128,80 @@ class Alert(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Alert related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.AlertProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: Alert related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AlertProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'AlertProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "AlertProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["AlertProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.AlertProperties"] = None, **kwargs ): - super(Alert, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: Alert related data. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AlertProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class AlertCollection(msrest.serialization.Model): +class AlertCollection(_serialization.Model): """Collection of alerts. - :param value: The list of alerts. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Alert] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The list of alerts. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Alert] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Alert]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Alert]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["Alert"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(AlertCollection, self).__init__(**kwargs) + def __init__(self, *, value: Optional[List["_models.Alert"]] = None, next_link: Optional[str] = None, **kwargs): + """ + :keyword value: The list of alerts. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Alert] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class AlertProperties(msrest.serialization.Model): +class AlertProperties(_serialization.Model): """The properties of an alert. - :param send_to_owners: A value indicating whether to send email to subscription administrator. - :type send_to_owners: str - :param custom_email_addresses: The custom email address for sending emails. - :type custom_email_addresses: list[str] - :param locale: The locale for the email notification. - :type locale: str + :ivar send_to_owners: A value indicating whether to send email to subscription administrator. + :vartype send_to_owners: str + :ivar custom_email_addresses: The custom email address for sending emails. + :vartype custom_email_addresses: list[str] + :ivar locale: The locale for the email notification. + :vartype locale: str """ _attribute_map = { - 'send_to_owners': {'key': 'sendToOwners', 'type': 'str'}, - 'custom_email_addresses': {'key': 'customEmailAddresses', 'type': '[str]'}, - 'locale': {'key': 'locale', 'type': 'str'}, + "send_to_owners": {"key": "sendToOwners", "type": "str"}, + "custom_email_addresses": {"key": "customEmailAddresses", "type": "[str]"}, + "locale": {"key": "locale", "type": "str"}, } def __init__( @@ -3255,110 +4212,212 @@ def __init__( locale: Optional[str] = None, **kwargs ): - super(AlertProperties, self).__init__(**kwargs) + """ + :keyword send_to_owners: A value indicating whether to send email to subscription + administrator. + :paramtype send_to_owners: str + :keyword custom_email_addresses: The custom email address for sending emails. + :paramtype custom_email_addresses: list[str] + :keyword locale: The locale for the email notification. + :paramtype locale: str + """ + super().__init__(**kwargs) self.send_to_owners = send_to_owners self.custom_email_addresses = custom_email_addresses self.locale = locale -class ApplyRecoveryPointInput(msrest.serialization.Model): +class ApplianceCollection(_serialization.Model): + """Collection of appliance details. + + :ivar value: The appliance details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] + :ivar next_link: The value of next link. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ReplicationAppliance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ReplicationAppliance"]] = None, next_link: Optional[str] = None, **kwargs + ): + """ + :keyword value: The appliance details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplianceQueryParameter(_serialization.Model): + """Query parameter to get appliance. + + :ivar provider_type: The providerType to be used for fetching appliance details. + :vartype provider_type: str + """ + + _attribute_map = { + "provider_type": {"key": "providerType", "type": "str"}, + } + + def __init__(self, *, provider_type: Optional[str] = None, **kwargs): + """ + :keyword provider_type: The providerType to be used for fetching appliance details. + :paramtype provider_type: str + """ + super().__init__(**kwargs) + self.provider_type = provider_type + + +class ApplianceSpecificDetails(_serialization.Model): + """Appliance specific details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InMageRcmApplianceSpecificDetails + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + } + + _subtype_map = {"instance_type": {"InMageRcm": "InMageRcmApplianceSpecificDetails"}} + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = None # type: Optional[str] + + +class ApplyRecoveryPointInput(_serialization.Model): """Input to apply recovery point. All required parameters must be populated in order to send to Azure. - :param properties: Required. The input properties to apply recovery point. - :type properties: + :ivar properties: The input properties to apply recovery point. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ApplyRecoveryPointInputProperties'}, + "properties": {"key": "properties", "type": "ApplyRecoveryPointInputProperties"}, } - def __init__( - self, - *, - properties: "ApplyRecoveryPointInputProperties", - **kwargs - ): - super(ApplyRecoveryPointInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.ApplyRecoveryPointInputProperties", **kwargs): + """ + :keyword properties: The input properties to apply recovery point. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class ApplyRecoveryPointInputProperties(msrest.serialization.Model): +class ApplyRecoveryPointInputProperties(_serialization.Model): """Input properties to apply recovery point. All required parameters must be populated in order to send to Azure. - :param recovery_point_id: The recovery point Id. - :type recovery_point_id: str - :param provider_specific_details: Required. Provider specific input for applying recovery - point. - :type provider_specific_details: + :ivar recovery_point_id: The recovery point Id. + :vartype recovery_point_id: str + :ivar provider_specific_details: Provider specific input for applying recovery point. Required. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput """ _validation = { - 'provider_specific_details': {'required': True}, + "provider_specific_details": {"required": True}, } _attribute_map = { - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ApplyRecoveryPointProviderSpecificInput'}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "ApplyRecoveryPointProviderSpecificInput", + }, } def __init__( self, *, - provider_specific_details: "ApplyRecoveryPointProviderSpecificInput", + provider_specific_details: "_models.ApplyRecoveryPointProviderSpecificInput", recovery_point_id: Optional[str] = None, **kwargs ): - super(ApplyRecoveryPointInputProperties, self).__init__(**kwargs) + """ + :keyword recovery_point_id: The recovery point Id. + :paramtype recovery_point_id: str + :keyword provider_specific_details: Provider specific input for applying recovery point. + Required. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput + """ + super().__init__(**kwargs) self.recovery_point_id = recovery_point_id self.provider_specific_details = provider_specific_details -class JobDetails(msrest.serialization.Model): +class JobDetails(_serialization.Model): """Job details based on specific job type. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AsrJobDetails, ExportJobDetails, FailoverJobDetails, SwitchProtectionJobDetails, TestFailoverJobDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AsrJobDetails, ExportJobDetails, FailoverJobDetails, SwitchProtectionJobDetails, + TestFailoverJobDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. + :vartype instance_type: str + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, } _subtype_map = { - 'instance_type': {'AsrJobDetails': 'AsrJobDetails', 'ExportJobDetails': 'ExportJobDetails', 'FailoverJobDetails': 'FailoverJobDetails', 'SwitchProtectionJobDetails': 'SwitchProtectionJobDetails', 'TestFailoverJobDetails': 'TestFailoverJobDetails'} - } - - def __init__( - self, - *, - affected_object_details: Optional[Dict[str, str]] = None, - **kwargs - ): - super(JobDetails, self).__init__(**kwargs) + "instance_type": { + "AsrJobDetails": "AsrJobDetails", + "ExportJobDetails": "ExportJobDetails", + "FailoverJobDetails": "FailoverJobDetails", + "SwitchProtectionJobDetails": "SwitchProtectionJobDetails", + "TestFailoverJobDetails": "TestFailoverJobDetails", + } + } + + def __init__(self, *, affected_object_details: Optional[Dict[str, str]] = None, **kwargs): + """ + :keyword affected_object_details: The affected object properties like source server, source + cloud, target server, target cloud etc. based on the workflow object details. + :paramtype affected_object_details: dict[str, str] + """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] self.affected_object_details = affected_object_details @@ -3368,79 +4427,79 @@ class AsrJobDetails(JobDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. + :vartype instance_type: str + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, } - def __init__( - self, - *, - affected_object_details: Optional[Dict[str, str]] = None, - **kwargs - ): - super(AsrJobDetails, self).__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type = 'AsrJobDetails' # type: str + def __init__(self, *, affected_object_details: Optional[Dict[str, str]] = None, **kwargs): + """ + :keyword affected_object_details: The affected object properties like source server, source + cloud, target server, target cloud etc. based on the workflow object details. + :paramtype affected_object_details: dict[str, str] + """ + super().__init__(affected_object_details=affected_object_details, **kwargs) + self.instance_type = "AsrJobDetails" # type: str -class ASRTask(msrest.serialization.Model): +class ASRTask(_serialization.Model): # pylint: disable=too-many-instance-attributes """Task of the Job. - :param task_id: The Id. - :type task_id: str - :param name: The unique Task name. - :type name: str - :param start_time: The start time. - :type start_time: ~datetime.datetime - :param end_time: The end time. - :type end_time: ~datetime.datetime - :param allowed_actions: The state/actions applicable on this task. - :type allowed_actions: list[str] - :param friendly_name: The name. - :type friendly_name: str - :param state: The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, + :ivar task_id: The Id. + :vartype task_id: str + :ivar name: The unique Task name. + :vartype name: str + :ivar start_time: The start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time. + :vartype end_time: ~datetime.datetime + :ivar allowed_actions: The state/actions applicable on this task. + :vartype allowed_actions: list[str] + :ivar friendly_name: The name. + :vartype friendly_name: str + :ivar state: The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other. - :type state: str - :param state_description: The description of the task state. For example - For Succeeded state, + :vartype state: str + :ivar state_description: The description of the task state. For example - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - :type state_description: str - :param task_type: The type of task. Details in CustomDetails property depend on this type. - :type task_type: str - :param custom_details: The custom task details based on the task type. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.TaskTypeDetails - :param group_task_custom_details: The custom task details based on the task type, if the task + :vartype state_description: str + :ivar task_type: The type of task. Details in CustomDetails property depend on this type. + :vartype task_type: str + :ivar custom_details: The custom task details based on the task type. + :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.TaskTypeDetails + :ivar group_task_custom_details: The custom task details based on the task type, if the task type is GroupTaskDetails or one of the types derived from it. - :type group_task_custom_details: + :vartype group_task_custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.GroupTaskDetails - :param errors: The task error details. - :type errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] + :ivar errors: The task error details. + :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'allowed_actions': {'key': 'allowedActions', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'state_description': {'key': 'stateDescription', 'type': 'str'}, - 'task_type': {'key': 'taskType', 'type': 'str'}, - 'custom_details': {'key': 'customDetails', 'type': 'TaskTypeDetails'}, - 'group_task_custom_details': {'key': 'groupTaskCustomDetails', 'type': 'GroupTaskDetails'}, - 'errors': {'key': 'errors', 'type': '[JobErrorDetails]'}, + "task_id": {"key": "taskId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "allowed_actions": {"key": "allowedActions", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "state_description": {"key": "stateDescription", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "custom_details": {"key": "customDetails", "type": "TaskTypeDetails"}, + "group_task_custom_details": {"key": "groupTaskCustomDetails", "type": "GroupTaskDetails"}, + "errors": {"key": "errors", "type": "[JobErrorDetails]"}, } def __init__( @@ -3455,12 +4514,42 @@ def __init__( state: Optional[str] = None, state_description: Optional[str] = None, task_type: Optional[str] = None, - custom_details: Optional["TaskTypeDetails"] = None, - group_task_custom_details: Optional["GroupTaskDetails"] = None, - errors: Optional[List["JobErrorDetails"]] = None, - **kwargs - ): - super(ASRTask, self).__init__(**kwargs) + custom_details: Optional["_models.TaskTypeDetails"] = None, + group_task_custom_details: Optional["_models.GroupTaskDetails"] = None, + errors: Optional[List["_models.JobErrorDetails"]] = None, + **kwargs + ): + """ + :keyword task_id: The Id. + :paramtype task_id: str + :keyword name: The unique Task name. + :paramtype name: str + :keyword start_time: The start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time. + :paramtype end_time: ~datetime.datetime + :keyword allowed_actions: The state/actions applicable on this task. + :paramtype allowed_actions: list[str] + :keyword friendly_name: The name. + :paramtype friendly_name: str + :keyword state: The State. It is one of these values - NotStarted, InProgress, Succeeded, + Failed, Cancelled, Suspended or Other. + :paramtype state: str + :keyword state_description: The description of the task state. For example - For Succeeded + state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. + :paramtype state_description: str + :keyword task_type: The type of task. Details in CustomDetails property depend on this type. + :paramtype task_type: str + :keyword custom_details: The custom task details based on the task type. + :paramtype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.TaskTypeDetails + :keyword group_task_custom_details: The custom task details based on the task type, if the task + type is GroupTaskDetails or one of the types derived from it. + :paramtype group_task_custom_details: + ~azure.mgmt.recoveryservicessiterecovery.models.GroupTaskDetails + :keyword errors: The task error details. + :paramtype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] + """ + super().__init__(**kwargs) self.task_id = task_id self.name = name self.start_time = start_time @@ -3475,35 +4564,41 @@ def __init__( self.errors = errors -class TaskTypeDetails(msrest.serialization.Model): +class TaskTypeDetails(_serialization.Model): """Task details based on specific task type. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AutomationRunbookTaskDetails, ConsistencyCheckTaskDetails, JobTaskDetails, ManualActionTaskDetails, ScriptActionTaskDetails, VmNicUpdatesTaskDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AutomationRunbookTaskDetails, ConsistencyCheckTaskDetails, JobTaskDetails, + ManualActionTaskDetails, ScriptActionTaskDetails, VmNicUpdatesTaskDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'AutomationRunbookTaskDetails': 'AutomationRunbookTaskDetails', 'ConsistencyCheckTaskDetails': 'ConsistencyCheckTaskDetails', 'JobTaskDetails': 'JobTaskDetails', 'ManualActionTaskDetails': 'ManualActionTaskDetails', 'ScriptActionTaskDetails': 'ScriptActionTaskDetails', 'VmNicUpdatesTaskDetails': 'VmNicUpdatesTaskDetails'} - } - - def __init__( - self, - **kwargs - ): - super(TaskTypeDetails, self).__init__(**kwargs) + "instance_type": { + "AutomationRunbookTaskDetails": "AutomationRunbookTaskDetails", + "ConsistencyCheckTaskDetails": "ConsistencyCheckTaskDetails", + "JobTaskDetails": "JobTaskDetails", + "ManualActionTaskDetails": "ManualActionTaskDetails", + "ScriptActionTaskDetails": "ScriptActionTaskDetails", + "VmNicUpdatesTaskDetails": "VmNicUpdatesTaskDetails", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -3512,43 +4607,43 @@ class AutomationRunbookTaskDetails(TaskTypeDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param name: The recovery plan task name. - :type name: str - :param cloud_service_name: The cloud service of the automation runbook account. - :type cloud_service_name: str - :param subscription_id: The subscription Id of the automation runbook account. - :type subscription_id: str - :param account_name: The automation account name of the runbook. - :type account_name: str - :param runbook_id: The runbook Id. - :type runbook_id: str - :param runbook_name: The runbook name. - :type runbook_name: str - :param job_id: The job Id of the runbook execution. - :type job_id: str - :param job_output: The execution output of the runbook. - :type job_output: str - :param is_primary_side_script: A value indicating whether it is a primary side script or not. - :type is_primary_side_script: bool + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar name: The recovery plan task name. + :vartype name: str + :ivar cloud_service_name: The cloud service of the automation runbook account. + :vartype cloud_service_name: str + :ivar subscription_id: The subscription Id of the automation runbook account. + :vartype subscription_id: str + :ivar account_name: The automation account name of the runbook. + :vartype account_name: str + :ivar runbook_id: The runbook Id. + :vartype runbook_id: str + :ivar runbook_name: The runbook name. + :vartype runbook_name: str + :ivar job_id: The job Id of the runbook execution. + :vartype job_id: str + :ivar job_output: The execution output of the runbook. + :vartype job_output: str + :ivar is_primary_side_script: A value indicating whether it is a primary side script or not. + :vartype is_primary_side_script: bool """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'cloud_service_name': {'key': 'cloudServiceName', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'runbook_id': {'key': 'runbookId', 'type': 'str'}, - 'runbook_name': {'key': 'runbookName', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'job_output': {'key': 'jobOutput', 'type': 'str'}, - 'is_primary_side_script': {'key': 'isPrimarySideScript', 'type': 'bool'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "cloud_service_name": {"key": "cloudServiceName", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "runbook_id": {"key": "runbookId", "type": "str"}, + "runbook_name": {"key": "runbookName", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "job_output": {"key": "jobOutput", "type": "str"}, + "is_primary_side_script": {"key": "isPrimarySideScript", "type": "bool"}, } def __init__( @@ -3565,8 +4660,28 @@ def __init__( is_primary_side_script: Optional[bool] = None, **kwargs ): - super(AutomationRunbookTaskDetails, self).__init__(**kwargs) - self.instance_type = 'AutomationRunbookTaskDetails' # type: str + """ + :keyword name: The recovery plan task name. + :paramtype name: str + :keyword cloud_service_name: The cloud service of the automation runbook account. + :paramtype cloud_service_name: str + :keyword subscription_id: The subscription Id of the automation runbook account. + :paramtype subscription_id: str + :keyword account_name: The automation account name of the runbook. + :paramtype account_name: str + :keyword runbook_id: The runbook Id. + :paramtype runbook_id: str + :keyword runbook_name: The runbook name. + :paramtype runbook_name: str + :keyword job_id: The job Id of the runbook execution. + :paramtype job_id: str + :keyword job_output: The execution output of the runbook. + :paramtype job_output: str + :keyword is_primary_side_script: A value indicating whether it is a primary side script or not. + :paramtype is_primary_side_script: bool + """ + super().__init__(**kwargs) + self.instance_type = "AutomationRunbookTaskDetails" # type: str self.name = name self.cloud_service_name = cloud_service_name self.subscription_id = subscription_id @@ -3578,35 +4693,37 @@ def __init__( self.is_primary_side_script = is_primary_side_script -class FabricSpecificCreationInput(msrest.serialization.Model): +class FabricSpecificCreationInput(_serialization.Model): """Fabric provider specific settings. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFabricCreationInput, InMageRcmFabricCreationInput, VMwareV2FabricCreationInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFabricCreationInput, InMageRcmFabricCreationInput, VMwareV2FabricCreationInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'Azure': 'AzureFabricCreationInput', 'InMageRcm': 'InMageRcmFabricCreationInput', 'VMwareV2': 'VMwareV2FabricCreationInput'} + "instance_type": { + "Azure": "AzureFabricCreationInput", + "InMageRcm": "InMageRcmFabricCreationInput", + "VMwareV2": "VMwareV2FabricCreationInput", + } } - def __init__( - self, - **kwargs - ): - super(FabricSpecificCreationInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -3615,62 +4732,66 @@ class AzureFabricCreationInput(FabricSpecificCreationInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type.Constant filled by server. - :type instance_type: str - :param location: The Location. - :type location: str + :ivar instance_type: Gets the class type. Required. + :vartype instance_type: str + :ivar location: The Location. + :vartype location: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: Optional[str] = None, - **kwargs - ): - super(AzureFabricCreationInput, self).__init__(**kwargs) - self.instance_type = 'Azure' # type: str + def __init__(self, *, location: Optional[str] = None, **kwargs): + """ + :keyword location: The Location. + :paramtype location: str + """ + super().__init__(**kwargs) + self.instance_type = "Azure" # type: str self.location = location -class FabricSpecificDetails(msrest.serialization.Model): +class FabricSpecificDetails(_serialization.Model): """Fabric specific details. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFabricSpecificDetails, HyperVSiteDetails, InMageRcmFabricSpecificDetails, VmmDetails, VMwareDetails, VMwareV2FabricSpecificDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFabricSpecificDetails, HyperVSiteDetails, InMageRcmFabricSpecificDetails, VmmDetails, + VMwareDetails, VMwareV2FabricSpecificDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'Azure': 'AzureFabricSpecificDetails', 'HyperVSite': 'HyperVSiteDetails', 'InMageRcm': 'InMageRcmFabricSpecificDetails', 'VMM': 'VmmDetails', 'VMware': 'VMwareDetails', 'VMwareV2': 'VMwareV2FabricSpecificDetails'} - } - - def __init__( - self, - **kwargs - ): - super(FabricSpecificDetails, self).__init__(**kwargs) + "instance_type": { + "Azure": "AzureFabricSpecificDetails", + "HyperVSite": "HyperVSiteDetails", + "InMageRcm": "InMageRcmFabricSpecificDetails", + "VMM": "VmmDetails", + "VMware": "VMwareDetails", + "VMwareV2": "VMwareV2FabricSpecificDetails", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -3679,26 +4800,25 @@ class AzureFabricSpecificDetails(FabricSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param location: The Location for the Azure fabric. - :type location: str - :param container_ids: The container Ids for the Azure fabric. - :type container_ids: list[str] - :param zones: The zones. - :type zones: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AZoneDetails] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar location: The Location for the Azure fabric. + :vartype location: str + :ivar container_ids: The container Ids for the Azure fabric. + :vartype container_ids: list[str] + :ivar zones: The zones. + :vartype zones: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AZoneDetails] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'container_ids': {'key': 'containerIds', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[A2AZoneDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "container_ids": {"key": "containerIds", "type": "[str]"}, + "zones": {"key": "zones", "type": "[A2AZoneDetails]"}, } def __init__( @@ -3706,45 +4826,56 @@ def __init__( *, location: Optional[str] = None, container_ids: Optional[List[str]] = None, - zones: Optional[List["A2AZoneDetails"]] = None, - **kwargs - ): - super(AzureFabricSpecificDetails, self).__init__(**kwargs) - self.instance_type = 'Azure' # type: str + zones: Optional[List["_models.A2AZoneDetails"]] = None, + **kwargs + ): + """ + :keyword location: The Location for the Azure fabric. + :paramtype location: str + :keyword container_ids: The container Ids for the Azure fabric. + :paramtype container_ids: list[str] + :keyword zones: The zones. + :paramtype zones: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AZoneDetails] + """ + super().__init__(**kwargs) + self.instance_type = "Azure" # type: str self.location = location self.container_ids = container_ids self.zones = zones -class FabricSpecificCreateNetworkMappingInput(msrest.serialization.Model): +class FabricSpecificCreateNetworkMappingInput(_serialization.Model): """Input details specific to fabrics during Network Mapping. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureToAzureCreateNetworkMappingInput, VmmToAzureCreateNetworkMappingInput, VmmToVmmCreateNetworkMappingInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureToAzureCreateNetworkMappingInput, VmmToAzureCreateNetworkMappingInput, + VmmToVmmCreateNetworkMappingInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'AzureToAzure': 'AzureToAzureCreateNetworkMappingInput', 'VmmToAzure': 'VmmToAzureCreateNetworkMappingInput', 'VmmToVmm': 'VmmToVmmCreateNetworkMappingInput'} + "instance_type": { + "AzureToAzure": "AzureToAzureCreateNetworkMappingInput", + "VmmToAzure": "VmmToAzureCreateNetworkMappingInput", + "VmmToVmm": "VmmToVmmCreateNetworkMappingInput", + } } - def __init__( - self, - **kwargs - ): - super(FabricSpecificCreateNetworkMappingInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -3753,62 +4884,64 @@ class AzureToAzureCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingIn All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - :param primary_network_id: Required. The primary azure vnet Id. - :type primary_network_id: str + :ivar instance_type: The instance type. Required. + :vartype instance_type: str + :ivar primary_network_id: The primary azure vnet Id. Required. + :vartype primary_network_id: str """ _validation = { - 'instance_type': {'required': True}, - 'primary_network_id': {'required': True}, + "instance_type": {"required": True}, + "primary_network_id": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_network_id': {'key': 'primaryNetworkId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_network_id": {"key": "primaryNetworkId", "type": "str"}, } - def __init__( - self, - *, - primary_network_id: str, - **kwargs - ): - super(AzureToAzureCreateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'AzureToAzure' # type: str + def __init__(self, *, primary_network_id: str, **kwargs): + """ + :keyword primary_network_id: The primary azure vnet Id. Required. + :paramtype primary_network_id: str + """ + super().__init__(**kwargs) + self.instance_type = "AzureToAzure" # type: str self.primary_network_id = primary_network_id -class NetworkMappingFabricSpecificSettings(msrest.serialization.Model): +class NetworkMappingFabricSpecificSettings(_serialization.Model): """Network Mapping fabric specific settings. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureToAzureNetworkMappingSettings, VmmToAzureNetworkMappingSettings, VmmToVmmNetworkMappingSettings. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureToAzureNetworkMappingSettings, VmmToAzureNetworkMappingSettings, + VmmToVmmNetworkMappingSettings All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'AzureToAzure': 'AzureToAzureNetworkMappingSettings', 'VmmToAzure': 'VmmToAzureNetworkMappingSettings', 'VmmToVmm': 'VmmToVmmNetworkMappingSettings'} + "instance_type": { + "AzureToAzure": "AzureToAzureNetworkMappingSettings", + "VmmToAzure": "VmmToAzureNetworkMappingSettings", + "VmmToVmm": "VmmToVmmNetworkMappingSettings", + } } - def __init__( - self, - **kwargs - ): - super(NetworkMappingFabricSpecificSettings, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -3817,66 +4950,71 @@ class AzureToAzureNetworkMappingSettings(NetworkMappingFabricSpecificSettings): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param primary_fabric_location: The primary fabric location. - :type primary_fabric_location: str - :param recovery_fabric_location: The recovery fabric location. - :type recovery_fabric_location: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar primary_fabric_location: The primary fabric location. + :vartype primary_fabric_location: str + :ivar recovery_fabric_location: The recovery fabric location. + :vartype recovery_fabric_location: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_fabric_location': {'key': 'primaryFabricLocation', 'type': 'str'}, - 'recovery_fabric_location': {'key': 'recoveryFabricLocation', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_fabric_location": {"key": "primaryFabricLocation", "type": "str"}, + "recovery_fabric_location": {"key": "recoveryFabricLocation", "type": "str"}, } def __init__( - self, - *, - primary_fabric_location: Optional[str] = None, - recovery_fabric_location: Optional[str] = None, - **kwargs + self, *, primary_fabric_location: Optional[str] = None, recovery_fabric_location: Optional[str] = None, **kwargs ): - super(AzureToAzureNetworkMappingSettings, self).__init__(**kwargs) - self.instance_type = 'AzureToAzure' # type: str + """ + :keyword primary_fabric_location: The primary fabric location. + :paramtype primary_fabric_location: str + :keyword recovery_fabric_location: The recovery fabric location. + :paramtype recovery_fabric_location: str + """ + super().__init__(**kwargs) + self.instance_type = "AzureToAzure" # type: str self.primary_fabric_location = primary_fabric_location self.recovery_fabric_location = recovery_fabric_location -class FabricSpecificUpdateNetworkMappingInput(msrest.serialization.Model): +class FabricSpecificUpdateNetworkMappingInput(_serialization.Model): """Input details specific to fabrics during Network Mapping. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureToAzureUpdateNetworkMappingInput, VmmToAzureUpdateNetworkMappingInput, VmmToVmmUpdateNetworkMappingInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureToAzureUpdateNetworkMappingInput, VmmToAzureUpdateNetworkMappingInput, + VmmToVmmUpdateNetworkMappingInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'AzureToAzure': 'AzureToAzureUpdateNetworkMappingInput', 'VmmToAzure': 'VmmToAzureUpdateNetworkMappingInput', 'VmmToVmm': 'VmmToVmmUpdateNetworkMappingInput'} + "instance_type": { + "AzureToAzure": "AzureToAzureUpdateNetworkMappingInput", + "VmmToAzure": "VmmToAzureUpdateNetworkMappingInput", + "VmmToVmm": "VmmToVmmUpdateNetworkMappingInput", + } } - def __init__( - self, - **kwargs - ): - super(FabricSpecificUpdateNetworkMappingInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -3885,94 +5023,99 @@ class AzureToAzureUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingIn All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str - :param primary_network_id: The primary azure vnet Id. - :type primary_network_id: str + :ivar instance_type: The instance type. Required. + :vartype instance_type: str + :ivar primary_network_id: The primary azure vnet Id. + :vartype primary_network_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_network_id': {'key': 'primaryNetworkId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_network_id": {"key": "primaryNetworkId", "type": "str"}, } - def __init__( - self, - *, - primary_network_id: Optional[str] = None, - **kwargs - ): - super(AzureToAzureUpdateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'AzureToAzure' # type: str + def __init__(self, *, primary_network_id: Optional[str] = None, **kwargs): + """ + :keyword primary_network_id: The primary azure vnet Id. + :paramtype primary_network_id: str + """ + super().__init__(**kwargs) + self.instance_type = "AzureToAzure" # type: str self.primary_network_id = primary_network_id -class AzureToAzureVmSyncedConfigDetails(msrest.serialization.Model): +class AzureToAzureVmSyncedConfigDetails(_serialization.Model): """Azure to Azure VM synced configuration details. - :param tags: A set of tags. The Azure VM tags. - :type tags: dict[str, str] - :param input_endpoints: The Azure VM input endpoints. - :type input_endpoints: list[~azure.mgmt.recoveryservicessiterecovery.models.InputEndpoint] + :ivar tags: The Azure VM tags. + :vartype tags: dict[str, str] + :ivar input_endpoints: The Azure VM input endpoints. + :vartype input_endpoints: list[~azure.mgmt.recoveryservicessiterecovery.models.InputEndpoint] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'input_endpoints': {'key': 'inputEndpoints', 'type': '[InputEndpoint]'}, + "tags": {"key": "tags", "type": "{str}"}, + "input_endpoints": {"key": "inputEndpoints", "type": "[InputEndpoint]"}, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, - input_endpoints: Optional[List["InputEndpoint"]] = None, + input_endpoints: Optional[List["_models.InputEndpoint"]] = None, **kwargs ): - super(AzureToAzureVmSyncedConfigDetails, self).__init__(**kwargs) + """ + :keyword tags: The Azure VM tags. + :paramtype tags: dict[str, str] + :keyword input_endpoints: The Azure VM input endpoints. + :paramtype input_endpoints: list[~azure.mgmt.recoveryservicessiterecovery.models.InputEndpoint] + """ + super().__init__(**kwargs) self.tags = tags self.input_endpoints = input_endpoints -class AzureVmDiskDetails(msrest.serialization.Model): +class AzureVmDiskDetails(_serialization.Model): """Disk details for E2A provider. - :param vhd_type: VHD type. - :type vhd_type: str - :param vhd_id: The VHD id. - :type vhd_id: str - :param disk_id: The disk resource id. - :type disk_id: str - :param vhd_name: VHD name. - :type vhd_name: str - :param max_size_mb: Max side in MB. - :type max_size_mb: str - :param target_disk_location: Blob uri of the Azure disk. - :type target_disk_location: str - :param target_disk_name: The target Azure disk name. - :type target_disk_name: str - :param lun_id: Ordinal\LunId of the disk for the Azure VM. - :type lun_id: str - :param disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :type disk_encryption_set_id: str - :param custom_target_disk_name: The custom target Azure disk name. - :type custom_target_disk_name: str - """ - - _attribute_map = { - 'vhd_type': {'key': 'vhdType', 'type': 'str'}, - 'vhd_id': {'key': 'vhdId', 'type': 'str'}, - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'vhd_name': {'key': 'vhdName', 'type': 'str'}, - 'max_size_mb': {'key': 'maxSizeMB', 'type': 'str'}, - 'target_disk_location': {'key': 'targetDiskLocation', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, - 'lun_id': {'key': 'lunId', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'custom_target_disk_name': {'key': 'customTargetDiskName', 'type': 'str'}, + :ivar vhd_type: VHD type. + :vartype vhd_type: str + :ivar vhd_id: The VHD id. + :vartype vhd_id: str + :ivar disk_id: The disk resource id. + :vartype disk_id: str + :ivar vhd_name: VHD name. + :vartype vhd_name: str + :ivar max_size_mb: Max side in MB. + :vartype max_size_mb: str + :ivar target_disk_location: Blob uri of the Azure disk. + :vartype target_disk_location: str + :ivar target_disk_name: The target Azure disk name. + :vartype target_disk_name: str + :ivar lun_id: Ordinal\LunId of the disk for the Azure VM. + :vartype lun_id: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :vartype disk_encryption_set_id: str + :ivar custom_target_disk_name: The custom target Azure disk name. + :vartype custom_target_disk_name: str + """ + + _attribute_map = { + "vhd_type": {"key": "vhdType", "type": "str"}, + "vhd_id": {"key": "vhdId", "type": "str"}, + "disk_id": {"key": "diskId", "type": "str"}, + "vhd_name": {"key": "vhdName", "type": "str"}, + "max_size_mb": {"key": "maxSizeMB", "type": "str"}, + "target_disk_location": {"key": "targetDiskLocation", "type": "str"}, + "target_disk_name": {"key": "targetDiskName", "type": "str"}, + "lun_id": {"key": "lunId", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, + "custom_target_disk_name": {"key": "customTargetDiskName", "type": "str"}, } def __init__( @@ -3990,7 +5133,29 @@ def __init__( custom_target_disk_name: Optional[str] = None, **kwargs ): - super(AzureVmDiskDetails, self).__init__(**kwargs) + """ + :keyword vhd_type: VHD type. + :paramtype vhd_type: str + :keyword vhd_id: The VHD id. + :paramtype vhd_id: str + :keyword disk_id: The disk resource id. + :paramtype disk_id: str + :keyword vhd_name: VHD name. + :paramtype vhd_name: str + :keyword max_size_mb: Max side in MB. + :paramtype max_size_mb: str + :keyword target_disk_location: Blob uri of the Azure disk. + :paramtype target_disk_location: str + :keyword target_disk_name: The target Azure disk name. + :paramtype target_disk_name: str + :keyword lun_id: Ordinal\LunId of the disk for the Azure VM. + :paramtype lun_id: str + :keyword disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :paramtype disk_encryption_set_id: str + :keyword custom_target_disk_name: The custom target Azure disk name. + :paramtype custom_target_disk_name: str + """ + super().__init__(**kwargs) self.vhd_type = vhd_type self.vhd_id = vhd_id self.disk_id = disk_id @@ -4003,102 +5168,103 @@ def __init__( self.custom_target_disk_name = custom_target_disk_name -class ComputeSizeErrorDetails(msrest.serialization.Model): +class ComputeSizeErrorDetails(_serialization.Model): """Represents the error used to indicate why the target compute size is not applicable. - :param message: The error message. - :type message: str - :param severity: The severity of the error. - :type severity: str + :ivar message: The error message. + :vartype message: str + :ivar severity: The severity of the error. + :vartype severity: str """ _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'severity': {'key': 'severity', 'type': 'str'}, + "message": {"key": "message", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, } - def __init__( - self, - *, - message: Optional[str] = None, - severity: Optional[str] = None, - **kwargs - ): - super(ComputeSizeErrorDetails, self).__init__(**kwargs) + def __init__(self, *, message: Optional[str] = None, severity: Optional[str] = None, **kwargs): + """ + :keyword message: The error message. + :paramtype message: str + :keyword severity: The severity of the error. + :paramtype severity: str + """ + super().__init__(**kwargs) self.message = message self.severity = severity -class ConfigurationSettings(msrest.serialization.Model): +class ConfigurationSettings(_serialization.Model): """Replication provider specific settings. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: HyperVVirtualMachineDetails, ReplicationGroupDetails, VMwareVirtualMachineDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVVirtualMachineDetails, ReplicationGroupDetails, VMwareVirtualMachineDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'HyperVVirtualMachine': 'HyperVVirtualMachineDetails', 'ReplicationGroupDetails': 'ReplicationGroupDetails', 'VMwareVirtualMachine': 'VMwareVirtualMachineDetails'} + "instance_type": { + "HyperVVirtualMachine": "HyperVVirtualMachineDetails", + "ReplicationGroupDetails": "ReplicationGroupDetails", + "VMwareVirtualMachine": "VMwareVirtualMachineDetails", + } } - def __init__( - self, - **kwargs - ): - super(ConfigurationSettings, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class ConfigureAlertRequest(msrest.serialization.Model): +class ConfigureAlertRequest(_serialization.Model): """Request to configure alerts for the system. - :param properties: The properties of a configure alert request. - :type properties: + :ivar properties: The properties of a configure alert request. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ConfigureAlertRequestProperties'}, + "properties": {"key": "properties", "type": "ConfigureAlertRequestProperties"}, } - def __init__( - self, - *, - properties: Optional["ConfigureAlertRequestProperties"] = None, - **kwargs - ): - super(ConfigureAlertRequest, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.ConfigureAlertRequestProperties"] = None, **kwargs): + """ + :keyword properties: The properties of a configure alert request. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties + """ + super().__init__(**kwargs) self.properties = properties -class ConfigureAlertRequestProperties(msrest.serialization.Model): +class ConfigureAlertRequestProperties(_serialization.Model): """Properties of a configure alert request. - :param send_to_owners: A value indicating whether to send email to subscription administrator. - :type send_to_owners: str - :param custom_email_addresses: The custom email address for sending emails. - :type custom_email_addresses: list[str] - :param locale: The locale for the email notification. - :type locale: str + :ivar send_to_owners: A value indicating whether to send email to subscription administrator. + :vartype send_to_owners: str + :ivar custom_email_addresses: The custom email address for sending emails. + :vartype custom_email_addresses: list[str] + :ivar locale: The locale for the email notification. + :vartype locale: str """ _attribute_map = { - 'send_to_owners': {'key': 'sendToOwners', 'type': 'str'}, - 'custom_email_addresses': {'key': 'customEmailAddresses', 'type': '[str]'}, - 'locale': {'key': 'locale', 'type': 'str'}, + "send_to_owners": {"key": "sendToOwners", "type": "str"}, + "custom_email_addresses": {"key": "customEmailAddresses", "type": "[str]"}, + "locale": {"key": "locale", "type": "str"}, } def __init__( @@ -4109,7 +5275,16 @@ def __init__( locale: Optional[str] = None, **kwargs ): - super(ConfigureAlertRequestProperties, self).__init__(**kwargs) + """ + :keyword send_to_owners: A value indicating whether to send email to subscription + administrator. + :paramtype send_to_owners: str + :keyword custom_email_addresses: The custom email address for sending emails. + :paramtype custom_email_addresses: list[str] + :keyword locale: The locale for the email notification. + :paramtype locale: str + """ + super().__init__(**kwargs) self.send_to_owners = send_to_owners self.custom_email_addresses = custom_email_addresses self.locale = locale @@ -4120,82 +5295,83 @@ class ConsistencyCheckTaskDetails(TaskTypeDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param vm_details: The list of inconsistent Vm details. - :type vm_details: list[~azure.mgmt.recoveryservicessiterecovery.models.InconsistentVmDetails] + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar vm_details: The list of inconsistent Vm details. + :vartype vm_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InconsistentVmDetails] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_details': {'key': 'vmDetails', 'type': '[InconsistentVmDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "vm_details": {"key": "vmDetails", "type": "[InconsistentVmDetails]"}, } - def __init__( - self, - *, - vm_details: Optional[List["InconsistentVmDetails"]] = None, - **kwargs - ): - super(ConsistencyCheckTaskDetails, self).__init__(**kwargs) - self.instance_type = 'ConsistencyCheckTaskDetails' # type: str + def __init__(self, *, vm_details: Optional[List["_models.InconsistentVmDetails"]] = None, **kwargs): + """ + :keyword vm_details: The list of inconsistent Vm details. + :paramtype vm_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InconsistentVmDetails] + """ + super().__init__(**kwargs) + self.instance_type = "ConsistencyCheckTaskDetails" # type: str self.vm_details = vm_details -class CreateNetworkMappingInput(msrest.serialization.Model): +class CreateNetworkMappingInput(_serialization.Model): """Create network mappings input. All required parameters must be populated in order to send to Azure. - :param properties: Required. Input properties for creating network mapping. - :type properties: + :ivar properties: Input properties for creating network mapping. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateNetworkMappingInputProperties'}, + "properties": {"key": "properties", "type": "CreateNetworkMappingInputProperties"}, } - def __init__( - self, - *, - properties: "CreateNetworkMappingInputProperties", - **kwargs - ): - super(CreateNetworkMappingInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.CreateNetworkMappingInputProperties", **kwargs): + """ + :keyword properties: Input properties for creating network mapping. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class CreateNetworkMappingInputProperties(msrest.serialization.Model): +class CreateNetworkMappingInputProperties(_serialization.Model): """Common input details for network mapping operation. All required parameters must be populated in order to send to Azure. - :param recovery_fabric_name: Recovery fabric Name. - :type recovery_fabric_name: str - :param recovery_network_id: Required. Recovery network Id. - :type recovery_network_id: str - :param fabric_specific_details: Fabric specific input properties. - :type fabric_specific_details: + :ivar recovery_fabric_name: Recovery fabric Name. + :vartype recovery_fabric_name: str + :ivar recovery_network_id: Recovery network Id. Required. + :vartype recovery_network_id: str + :ivar fabric_specific_details: Fabric specific input properties. + :vartype fabric_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput """ _validation = { - 'recovery_network_id': {'required': True}, + "recovery_network_id": {"required": True}, } _attribute_map = { - 'recovery_fabric_name': {'key': 'recoveryFabricName', 'type': 'str'}, - 'recovery_network_id': {'key': 'recoveryNetworkId', 'type': 'str'}, - 'fabric_specific_details': {'key': 'fabricSpecificDetails', 'type': 'FabricSpecificCreateNetworkMappingInput'}, + "recovery_fabric_name": {"key": "recoveryFabricName", "type": "str"}, + "recovery_network_id": {"key": "recoveryNetworkId", "type": "str"}, + "fabric_specific_details": {"key": "fabricSpecificDetails", "type": "FabricSpecificCreateNetworkMappingInput"}, } def __init__( @@ -4203,140 +5379,163 @@ def __init__( *, recovery_network_id: str, recovery_fabric_name: Optional[str] = None, - fabric_specific_details: Optional["FabricSpecificCreateNetworkMappingInput"] = None, - **kwargs - ): - super(CreateNetworkMappingInputProperties, self).__init__(**kwargs) + fabric_specific_details: Optional["_models.FabricSpecificCreateNetworkMappingInput"] = None, + **kwargs + ): + """ + :keyword recovery_fabric_name: Recovery fabric Name. + :paramtype recovery_fabric_name: str + :keyword recovery_network_id: Recovery network Id. Required. + :paramtype recovery_network_id: str + :keyword fabric_specific_details: Fabric specific input properties. + :paramtype fabric_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput + """ + super().__init__(**kwargs) self.recovery_fabric_name = recovery_fabric_name self.recovery_network_id = recovery_network_id self.fabric_specific_details = fabric_specific_details -class CreatePolicyInput(msrest.serialization.Model): +class CreatePolicyInput(_serialization.Model): """Protection Policy input. - :param properties: Policy creation properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInputProperties + :ivar properties: Policy creation properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreatePolicyInputProperties'}, + "properties": {"key": "properties", "type": "CreatePolicyInputProperties"}, } - def __init__( - self, - *, - properties: Optional["CreatePolicyInputProperties"] = None, - **kwargs - ): - super(CreatePolicyInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.CreatePolicyInputProperties"] = None, **kwargs): + """ + :keyword properties: Policy creation properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class CreatePolicyInputProperties(msrest.serialization.Model): +class CreatePolicyInputProperties(_serialization.Model): """Policy creation properties. - :param provider_specific_input: The ReplicationProviderSettings. - :type provider_specific_input: + :ivar provider_specific_input: The ReplicationProviderSettings. + :vartype provider_specific_input: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput """ _attribute_map = { - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': 'PolicyProviderSpecificInput'}, + "provider_specific_input": {"key": "providerSpecificInput", "type": "PolicyProviderSpecificInput"}, } - def __init__( - self, - *, - provider_specific_input: Optional["PolicyProviderSpecificInput"] = None, - **kwargs - ): - super(CreatePolicyInputProperties, self).__init__(**kwargs) + def __init__(self, *, provider_specific_input: Optional["_models.PolicyProviderSpecificInput"] = None, **kwargs): + """ + :keyword provider_specific_input: The ReplicationProviderSettings. + :paramtype provider_specific_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput + """ + super().__init__(**kwargs) self.provider_specific_input = provider_specific_input -class CreateProtectionContainerInput(msrest.serialization.Model): +class CreateProtectionContainerInput(_serialization.Model): """Create protection container input. - :param properties: Create protection container input properties. - :type properties: + :ivar properties: Create protection container input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateProtectionContainerInputProperties'}, + "properties": {"key": "properties", "type": "CreateProtectionContainerInputProperties"}, } - def __init__( - self, - *, - properties: Optional["CreateProtectionContainerInputProperties"] = None, - **kwargs - ): - super(CreateProtectionContainerInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.CreateProtectionContainerInputProperties"] = None, **kwargs): + """ + :keyword properties: Create protection container input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class CreateProtectionContainerInputProperties(msrest.serialization.Model): +class CreateProtectionContainerInputProperties(_serialization.Model): """Create protection container input properties. - :param provider_specific_input: Provider specific inputs for container creation. - :type provider_specific_input: + :ivar provider_specific_input: Provider specific inputs for container creation. + :vartype provider_specific_input: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput] """ _attribute_map = { - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': '[ReplicationProviderSpecificContainerCreationInput]'}, + "provider_specific_input": { + "key": "providerSpecificInput", + "type": "[ReplicationProviderSpecificContainerCreationInput]", + }, } def __init__( self, *, - provider_specific_input: Optional[List["ReplicationProviderSpecificContainerCreationInput"]] = None, + provider_specific_input: Optional[List["_models.ReplicationProviderSpecificContainerCreationInput"]] = None, **kwargs ): - super(CreateProtectionContainerInputProperties, self).__init__(**kwargs) + """ + :keyword provider_specific_input: Provider specific inputs for container creation. + :paramtype provider_specific_input: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput] + """ + super().__init__(**kwargs) self.provider_specific_input = provider_specific_input -class CreateProtectionContainerMappingInput(msrest.serialization.Model): +class CreateProtectionContainerMappingInput(_serialization.Model): """Configure pairing input. - :param properties: Configure protection input properties. - :type properties: + :ivar properties: Configure protection input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateProtectionContainerMappingInputProperties'}, + "properties": {"key": "properties", "type": "CreateProtectionContainerMappingInputProperties"}, } def __init__( - self, - *, - properties: Optional["CreateProtectionContainerMappingInputProperties"] = None, - **kwargs + self, *, properties: Optional["_models.CreateProtectionContainerMappingInputProperties"] = None, **kwargs ): - super(CreateProtectionContainerMappingInput, self).__init__(**kwargs) + """ + :keyword properties: Configure protection input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class CreateProtectionContainerMappingInputProperties(msrest.serialization.Model): +class CreateProtectionContainerMappingInputProperties(_serialization.Model): """Configure pairing input properties. - :param target_protection_container_id: The target unique protection container name. - :type target_protection_container_id: str - :param policy_id: Applicable policy. - :type policy_id: str - :param provider_specific_input: Provider specific input for pairing. - :type provider_specific_input: + :ivar target_protection_container_id: The target unique protection container name. + :vartype target_protection_container_id: str + :ivar policy_id: Applicable policy. + :vartype policy_id: str + :ivar provider_specific_input: Provider specific input for pairing. + :vartype provider_specific_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput """ _attribute_map = { - 'target_protection_container_id': {'key': 'targetProtectionContainerId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': 'ReplicationProviderSpecificContainerMappingInput'}, + "target_protection_container_id": {"key": "targetProtectionContainerId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "provider_specific_input": { + "key": "providerSpecificInput", + "type": "ReplicationProviderSpecificContainerMappingInput", + }, } def __init__( @@ -4344,120 +5543,138 @@ def __init__( *, target_protection_container_id: Optional[str] = None, policy_id: Optional[str] = None, - provider_specific_input: Optional["ReplicationProviderSpecificContainerMappingInput"] = None, - **kwargs - ): - super(CreateProtectionContainerMappingInputProperties, self).__init__(**kwargs) + provider_specific_input: Optional["_models.ReplicationProviderSpecificContainerMappingInput"] = None, + **kwargs + ): + """ + :keyword target_protection_container_id: The target unique protection container name. + :paramtype target_protection_container_id: str + :keyword policy_id: Applicable policy. + :paramtype policy_id: str + :keyword provider_specific_input: Provider specific input for pairing. + :paramtype provider_specific_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput + """ + super().__init__(**kwargs) self.target_protection_container_id = target_protection_container_id self.policy_id = policy_id self.provider_specific_input = provider_specific_input -class CreateProtectionIntentInput(msrest.serialization.Model): +class CreateProtectionIntentInput(_serialization.Model): """Create protection intent input. - :param properties: Create protection intent input properties. - :type properties: + :ivar properties: Create protection intent input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateProtectionIntentProperties'}, + "properties": {"key": "properties", "type": "CreateProtectionIntentProperties"}, } - def __init__( - self, - *, - properties: Optional["CreateProtectionIntentProperties"] = None, - **kwargs - ): - super(CreateProtectionIntentInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.CreateProtectionIntentProperties"] = None, **kwargs): + """ + :keyword properties: Create protection intent input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProperties + """ + super().__init__(**kwargs) self.properties = properties -class CreateProtectionIntentProperties(msrest.serialization.Model): +class CreateProtectionIntentProperties(_serialization.Model): """Create protection intent input properties. - :param provider_specific_details: The ReplicationProviderInput. For A2A provider, it will be + :ivar provider_specific_details: The ReplicationProviderInput. For A2A provider, it will be A2ACreateProtectionIntentInput object. - :type provider_specific_details: + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails """ _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'CreateProtectionIntentProviderSpecificDetails'}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "CreateProtectionIntentProviderSpecificDetails", + }, } def __init__( self, *, - provider_specific_details: Optional["CreateProtectionIntentProviderSpecificDetails"] = None, + provider_specific_details: Optional["_models.CreateProtectionIntentProviderSpecificDetails"] = None, **kwargs ): - super(CreateProtectionIntentProperties, self).__init__(**kwargs) + """ + :keyword provider_specific_details: The ReplicationProviderInput. For A2A provider, it will be + A2ACreateProtectionIntentInput object. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails + """ + super().__init__(**kwargs) self.provider_specific_details = provider_specific_details -class CreateRecoveryPlanInput(msrest.serialization.Model): +class CreateRecoveryPlanInput(_serialization.Model): """Create recovery plan input class. All required parameters must be populated in order to send to Azure. - :param properties: Required. Recovery plan creation properties. - :type properties: + :ivar properties: Recovery plan creation properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CreateRecoveryPlanInputProperties'}, + "properties": {"key": "properties", "type": "CreateRecoveryPlanInputProperties"}, } - def __init__( - self, - *, - properties: "CreateRecoveryPlanInputProperties", - **kwargs - ): - super(CreateRecoveryPlanInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.CreateRecoveryPlanInputProperties", **kwargs): + """ + :keyword properties: Recovery plan creation properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class CreateRecoveryPlanInputProperties(msrest.serialization.Model): +class CreateRecoveryPlanInputProperties(_serialization.Model): """Recovery plan creation properties. All required parameters must be populated in order to send to Azure. - :param primary_fabric_id: Required. The primary fabric Id. - :type primary_fabric_id: str - :param recovery_fabric_id: Required. The recovery fabric Id. - :type recovery_fabric_id: str - :param failover_deployment_model: The failover deployment model. Possible values include: - "NotApplicable", "Classic", "ResourceManager". - :type failover_deployment_model: str or + :ivar primary_fabric_id: The primary fabric Id. Required. + :vartype primary_fabric_id: str + :ivar recovery_fabric_id: The recovery fabric Id. Required. + :vartype recovery_fabric_id: str + :ivar failover_deployment_model: The failover deployment model. Known values are: + "NotApplicable", "Classic", and "ResourceManager". + :vartype failover_deployment_model: str or ~azure.mgmt.recoveryservicessiterecovery.models.FailoverDeploymentModel - :param groups: Required. The recovery plan groups. - :type groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - :param provider_specific_input: The provider specific input. - :type provider_specific_input: + :ivar groups: The recovery plan groups. Required. + :vartype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] + :ivar provider_specific_input: The provider specific input. + :vartype provider_specific_input: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput] """ _validation = { - 'primary_fabric_id': {'required': True}, - 'recovery_fabric_id': {'required': True}, - 'groups': {'required': True}, + "primary_fabric_id": {"required": True}, + "recovery_fabric_id": {"required": True}, + "groups": {"required": True}, } _attribute_map = { - 'primary_fabric_id': {'key': 'primaryFabricId', 'type': 'str'}, - 'recovery_fabric_id': {'key': 'recoveryFabricId', 'type': 'str'}, - 'failover_deployment_model': {'key': 'failoverDeploymentModel', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[RecoveryPlanGroup]'}, - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': '[RecoveryPlanProviderSpecificInput]'}, + "primary_fabric_id": {"key": "primaryFabricId", "type": "str"}, + "recovery_fabric_id": {"key": "recoveryFabricId", "type": "str"}, + "failover_deployment_model": {"key": "failoverDeploymentModel", "type": "str"}, + "groups": {"key": "groups", "type": "[RecoveryPlanGroup]"}, + "provider_specific_input": {"key": "providerSpecificInput", "type": "[RecoveryPlanProviderSpecificInput]"}, } def __init__( @@ -4465,12 +5682,27 @@ def __init__( *, primary_fabric_id: str, recovery_fabric_id: str, - groups: List["RecoveryPlanGroup"], - failover_deployment_model: Optional[Union[str, "FailoverDeploymentModel"]] = None, - provider_specific_input: Optional[List["RecoveryPlanProviderSpecificInput"]] = None, - **kwargs - ): - super(CreateRecoveryPlanInputProperties, self).__init__(**kwargs) + groups: List["_models.RecoveryPlanGroup"], + failover_deployment_model: Optional[Union[str, "_models.FailoverDeploymentModel"]] = None, + provider_specific_input: Optional[List["_models.RecoveryPlanProviderSpecificInput"]] = None, + **kwargs + ): + """ + :keyword primary_fabric_id: The primary fabric Id. Required. + :paramtype primary_fabric_id: str + :keyword recovery_fabric_id: The recovery fabric Id. Required. + :paramtype recovery_fabric_id: str + :keyword failover_deployment_model: The failover deployment model. Known values are: + "NotApplicable", "Classic", and "ResourceManager". + :paramtype failover_deployment_model: str or + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverDeploymentModel + :keyword groups: The recovery plan groups. Required. + :paramtype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] + :keyword provider_specific_input: The provider specific input. + :paramtype provider_specific_input: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput] + """ + super().__init__(**kwargs) self.primary_fabric_id = primary_fabric_id self.recovery_fabric_id = recovery_fabric_id self.failover_deployment_model = failover_deployment_model @@ -4478,7 +5710,45 @@ def __init__( self.provider_specific_input = provider_specific_input -class CurrentJobDetails(msrest.serialization.Model): +class CriticalJobHistoryDetails(_serialization.Model): + """Critical past job details of the migration item. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_name: The job name. + :vartype job_name: str + :ivar job_id: The ARM Id of the job being executed. + :vartype job_id: str + :ivar start_time: The start time of the job. + :vartype start_time: ~datetime.datetime + :ivar job_status: The job state. + :vartype job_status: str + """ + + _validation = { + "job_name": {"readonly": True}, + "job_id": {"readonly": True}, + "start_time": {"readonly": True}, + "job_status": {"readonly": True}, + } + + _attribute_map = { + "job_name": {"key": "jobName", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "job_status": {"key": "jobStatus", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.job_name = None + self.job_id = None + self.start_time = None + self.job_status = None + + +class CurrentJobDetails(_serialization.Model): """Current job details of the migration item. Variables are only populated by the server, and will be ignored when sending a request. @@ -4492,42 +5762,40 @@ class CurrentJobDetails(msrest.serialization.Model): """ _validation = { - 'job_name': {'readonly': True}, - 'job_id': {'readonly': True}, - 'start_time': {'readonly': True}, + "job_name": {"readonly": True}, + "job_id": {"readonly": True}, + "start_time": {"readonly": True}, } _attribute_map = { - 'job_name': {'key': 'jobName', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + "job_name": {"key": "jobName", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, } - def __init__( - self, - **kwargs - ): - super(CurrentJobDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.job_name = None self.job_id = None self.start_time = None -class CurrentScenarioDetails(msrest.serialization.Model): +class CurrentScenarioDetails(_serialization.Model): """Current scenario details of the protected entity. - :param scenario_name: Scenario name. - :type scenario_name: str - :param job_id: ARM Id of the job being executed. - :type job_id: str - :param start_time: Start time of the workflow. - :type start_time: ~datetime.datetime + :ivar scenario_name: Scenario name. + :vartype scenario_name: str + :ivar job_id: ARM Id of the job being executed. + :vartype job_id: str + :ivar start_time: Start time of the workflow. + :vartype start_time: ~datetime.datetime """ _attribute_map = { - 'scenario_name': {'key': 'scenarioName', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + "scenario_name": {"key": "scenarioName", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, } def __init__( @@ -4538,33 +5806,41 @@ def __init__( start_time: Optional[datetime.datetime] = None, **kwargs ): - super(CurrentScenarioDetails, self).__init__(**kwargs) + """ + :keyword scenario_name: Scenario name. + :paramtype scenario_name: str + :keyword job_id: ARM Id of the job being executed. + :paramtype job_id: str + :keyword start_time: Start time of the workflow. + :paramtype start_time: ~datetime.datetime + """ + super().__init__(**kwargs) self.scenario_name = scenario_name self.job_id = job_id self.start_time = start_time -class DataStore(msrest.serialization.Model): +class DataStore(_serialization.Model): """The datastore details of the MT. - :param symbolic_name: The symbolic name of data store. - :type symbolic_name: str - :param uuid: The uuid of data store. - :type uuid: str - :param capacity: The capacity of data store in GBs. - :type capacity: str - :param free_space: The free space of data store in GBs. - :type free_space: str - :param type: The type of data store. - :type type: str + :ivar symbolic_name: The symbolic name of data store. + :vartype symbolic_name: str + :ivar uuid: The uuid of data store. + :vartype uuid: str + :ivar capacity: The capacity of data store in GBs. + :vartype capacity: str + :ivar free_space: The free space of data store in GBs. + :vartype free_space: str + :ivar type: The type of data store. + :vartype type: str """ _attribute_map = { - 'symbolic_name': {'key': 'symbolicName', 'type': 'str'}, - 'uuid': {'key': 'uuid', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'str'}, - 'free_space': {'key': 'freeSpace', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "symbolic_name": {"key": "symbolicName", "type": "str"}, + "uuid": {"key": "uuid", "type": "str"}, + "capacity": {"key": "capacity", "type": "str"}, + "free_space": {"key": "freeSpace", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -4577,7 +5853,19 @@ def __init__( type: Optional[str] = None, **kwargs ): - super(DataStore, self).__init__(**kwargs) + """ + :keyword symbolic_name: The symbolic name of data store. + :paramtype symbolic_name: str + :keyword uuid: The uuid of data store. + :paramtype uuid: str + :keyword capacity: The capacity of data store in GBs. + :paramtype capacity: str + :keyword free_space: The free space of data store in GBs. + :paramtype free_space: str + :keyword type: The type of data store. + :paramtype type: str + """ + super().__init__(**kwargs) self.symbolic_name = symbolic_name self.uuid = uuid self.capacity = capacity @@ -4585,132 +5873,140 @@ def __init__( self.type = type -class DisableProtectionInput(msrest.serialization.Model): +class DisableProtectionInput(_serialization.Model): """Disable protection input. All required parameters must be populated in order to send to Azure. - :param properties: Required. Disable protection input properties. - :type properties: + :ivar properties: Disable protection input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'DisableProtectionInputProperties'}, + "properties": {"key": "properties", "type": "DisableProtectionInputProperties"}, } - def __init__( - self, - *, - properties: "DisableProtectionInputProperties", - **kwargs - ): - super(DisableProtectionInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.DisableProtectionInputProperties", **kwargs): + """ + :keyword properties: Disable protection input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class DisableProtectionInputProperties(msrest.serialization.Model): +class DisableProtectionInputProperties(_serialization.Model): """Disable protection input properties. - :param disable_protection_reason: Disable protection reason. It can have values - NotSpecified/MigrationComplete. Possible values include: "NotSpecified", "MigrationComplete". - :type disable_protection_reason: str or + :ivar disable_protection_reason: Disable protection reason. It can have values + NotSpecified/MigrationComplete. Known values are: "NotSpecified" and "MigrationComplete". + :vartype disable_protection_reason: str or ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionReason - :param replication_provider_input: Replication provider specific input. - :type replication_provider_input: + :ivar replication_provider_input: Replication provider specific input. + :vartype replication_provider_input: ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput """ _attribute_map = { - 'disable_protection_reason': {'key': 'disableProtectionReason', 'type': 'str'}, - 'replication_provider_input': {'key': 'replicationProviderInput', 'type': 'DisableProtectionProviderSpecificInput'}, + "disable_protection_reason": {"key": "disableProtectionReason", "type": "str"}, + "replication_provider_input": { + "key": "replicationProviderInput", + "type": "DisableProtectionProviderSpecificInput", + }, } def __init__( self, *, - disable_protection_reason: Optional[Union[str, "DisableProtectionReason"]] = None, - replication_provider_input: Optional["DisableProtectionProviderSpecificInput"] = None, + disable_protection_reason: Optional[Union[str, "_models.DisableProtectionReason"]] = None, + replication_provider_input: Optional["_models.DisableProtectionProviderSpecificInput"] = None, **kwargs ): - super(DisableProtectionInputProperties, self).__init__(**kwargs) + """ + :keyword disable_protection_reason: Disable protection reason. It can have values + NotSpecified/MigrationComplete. Known values are: "NotSpecified" and "MigrationComplete". + :paramtype disable_protection_reason: str or + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionReason + :keyword replication_provider_input: Replication provider specific input. + :paramtype replication_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput + """ + super().__init__(**kwargs) self.disable_protection_reason = disable_protection_reason self.replication_provider_input = replication_provider_input -class DisableProtectionProviderSpecificInput(msrest.serialization.Model): +class DisableProtectionProviderSpecificInput(_serialization.Model): """Disable protection provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: InMageDisableProtectionProviderSpecificInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InMageDisableProtectionProviderSpecificInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'InMage': 'InMageDisableProtectionProviderSpecificInput'} - } + _subtype_map = {"instance_type": {"InMage": "InMageDisableProtectionProviderSpecificInput"}} - def __init__( - self, - **kwargs - ): - super(DisableProtectionProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class DiscoverProtectableItemRequest(msrest.serialization.Model): +class DiscoverProtectableItemRequest(_serialization.Model): """Request to add a physical machine as a protectable item in a container. - :param properties: The properties of a discover protectable item request. - :type properties: + :ivar properties: The properties of a discover protectable item request. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequestProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'DiscoverProtectableItemRequestProperties'}, + "properties": {"key": "properties", "type": "DiscoverProtectableItemRequestProperties"}, } - def __init__( - self, - *, - properties: Optional["DiscoverProtectableItemRequestProperties"] = None, - **kwargs - ): - super(DiscoverProtectableItemRequest, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.DiscoverProtectableItemRequestProperties"] = None, **kwargs): + """ + :keyword properties: The properties of a discover protectable item request. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequestProperties + """ + super().__init__(**kwargs) self.properties = properties -class DiscoverProtectableItemRequestProperties(msrest.serialization.Model): +class DiscoverProtectableItemRequestProperties(_serialization.Model): """Discover protectable item properties. - :param friendly_name: The friendly name of the physical machine. - :type friendly_name: str - :param ip_address: The IP address of the physical machine to be discovered. - :type ip_address: str - :param os_type: The OS type on the physical machine. - :type os_type: str + :ivar friendly_name: The friendly name of the physical machine. + :vartype friendly_name: str + :ivar ip_address: The IP address of the physical machine to be discovered. + :vartype ip_address: str + :ivar os_type: The OS type on the physical machine. + :vartype os_type: str """ _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, } def __init__( @@ -4721,30 +6017,38 @@ def __init__( os_type: Optional[str] = None, **kwargs ): - super(DiscoverProtectableItemRequestProperties, self).__init__(**kwargs) + """ + :keyword friendly_name: The friendly name of the physical machine. + :paramtype friendly_name: str + :keyword ip_address: The IP address of the physical machine to be discovered. + :paramtype ip_address: str + :keyword os_type: The OS type on the physical machine. + :paramtype os_type: str + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.ip_address = ip_address self.os_type = os_type -class DiskDetails(msrest.serialization.Model): +class DiskDetails(_serialization.Model): """Onprem disk details data. - :param max_size_mb: The hard disk max size in MB. - :type max_size_mb: long - :param vhd_type: The type of the volume. - :type vhd_type: str - :param vhd_id: The VHD Id. - :type vhd_id: str - :param vhd_name: The VHD name. - :type vhd_name: str + :ivar max_size_mb: The hard disk max size in MB. + :vartype max_size_mb: int + :ivar vhd_type: The type of the volume. + :vartype vhd_type: str + :ivar vhd_id: The VHD Id. + :vartype vhd_id: str + :ivar vhd_name: The VHD name. + :vartype vhd_name: str """ _attribute_map = { - 'max_size_mb': {'key': 'maxSizeMB', 'type': 'long'}, - 'vhd_type': {'key': 'vhdType', 'type': 'str'}, - 'vhd_id': {'key': 'vhdId', 'type': 'str'}, - 'vhd_name': {'key': 'vhdName', 'type': 'str'}, + "max_size_mb": {"key": "maxSizeMB", "type": "int"}, + "vhd_type": {"key": "vhdType", "type": "str"}, + "vhd_id": {"key": "vhdId", "type": "str"}, + "vhd_name": {"key": "vhdName", "type": "str"}, } def __init__( @@ -4756,127 +6060,147 @@ def __init__( vhd_name: Optional[str] = None, **kwargs ): - super(DiskDetails, self).__init__(**kwargs) + """ + :keyword max_size_mb: The hard disk max size in MB. + :paramtype max_size_mb: int + :keyword vhd_type: The type of the volume. + :paramtype vhd_type: str + :keyword vhd_id: The VHD Id. + :paramtype vhd_id: str + :keyword vhd_name: The VHD name. + :paramtype vhd_name: str + """ + super().__init__(**kwargs) self.max_size_mb = max_size_mb self.vhd_type = vhd_type self.vhd_id = vhd_id self.vhd_name = vhd_name -class DiskEncryptionInfo(msrest.serialization.Model): +class DiskEncryptionInfo(_serialization.Model): """Recovery disk encryption info (BEK and KEK). - :param disk_encryption_key_info: The recovery KeyVault reference for secret. - :type disk_encryption_key_info: + :ivar disk_encryption_key_info: The recovery KeyVault reference for secret. + :vartype disk_encryption_key_info: ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionKeyInfo - :param key_encryption_key_info: The recovery KeyVault reference for key. - :type key_encryption_key_info: + :ivar key_encryption_key_info: The recovery KeyVault reference for key. + :vartype key_encryption_key_info: ~azure.mgmt.recoveryservicessiterecovery.models.KeyEncryptionKeyInfo """ _attribute_map = { - 'disk_encryption_key_info': {'key': 'diskEncryptionKeyInfo', 'type': 'DiskEncryptionKeyInfo'}, - 'key_encryption_key_info': {'key': 'keyEncryptionKeyInfo', 'type': 'KeyEncryptionKeyInfo'}, + "disk_encryption_key_info": {"key": "diskEncryptionKeyInfo", "type": "DiskEncryptionKeyInfo"}, + "key_encryption_key_info": {"key": "keyEncryptionKeyInfo", "type": "KeyEncryptionKeyInfo"}, } def __init__( self, *, - disk_encryption_key_info: Optional["DiskEncryptionKeyInfo"] = None, - key_encryption_key_info: Optional["KeyEncryptionKeyInfo"] = None, + disk_encryption_key_info: Optional["_models.DiskEncryptionKeyInfo"] = None, + key_encryption_key_info: Optional["_models.KeyEncryptionKeyInfo"] = None, **kwargs ): - super(DiskEncryptionInfo, self).__init__(**kwargs) + """ + :keyword disk_encryption_key_info: The recovery KeyVault reference for secret. + :paramtype disk_encryption_key_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionKeyInfo + :keyword key_encryption_key_info: The recovery KeyVault reference for key. + :paramtype key_encryption_key_info: + ~azure.mgmt.recoveryservicessiterecovery.models.KeyEncryptionKeyInfo + """ + super().__init__(**kwargs) self.disk_encryption_key_info = disk_encryption_key_info self.key_encryption_key_info = key_encryption_key_info -class DiskEncryptionKeyInfo(msrest.serialization.Model): +class DiskEncryptionKeyInfo(_serialization.Model): """Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). - :param secret_identifier: The secret url / identifier. - :type secret_identifier: str - :param key_vault_resource_arm_id: The KeyVault resource ARM id for secret. - :type key_vault_resource_arm_id: str + :ivar secret_identifier: The secret url / identifier. + :vartype secret_identifier: str + :ivar key_vault_resource_arm_id: The KeyVault resource ARM id for secret. + :vartype key_vault_resource_arm_id: str """ _attribute_map = { - 'secret_identifier': {'key': 'secretIdentifier', 'type': 'str'}, - 'key_vault_resource_arm_id': {'key': 'keyVaultResourceArmId', 'type': 'str'}, + "secret_identifier": {"key": "secretIdentifier", "type": "str"}, + "key_vault_resource_arm_id": {"key": "keyVaultResourceArmId", "type": "str"}, } def __init__( - self, - *, - secret_identifier: Optional[str] = None, - key_vault_resource_arm_id: Optional[str] = None, - **kwargs + self, *, secret_identifier: Optional[str] = None, key_vault_resource_arm_id: Optional[str] = None, **kwargs ): - super(DiskEncryptionKeyInfo, self).__init__(**kwargs) + """ + :keyword secret_identifier: The secret url / identifier. + :paramtype secret_identifier: str + :keyword key_vault_resource_arm_id: The KeyVault resource ARM id for secret. + :paramtype key_vault_resource_arm_id: str + """ + super().__init__(**kwargs) self.secret_identifier = secret_identifier self.key_vault_resource_arm_id = key_vault_resource_arm_id -class DiskVolumeDetails(msrest.serialization.Model): +class DiskVolumeDetails(_serialization.Model): """Volume details. - :param label: The volume label. - :type label: str - :param name: The volume name. - :type name: str + :ivar label: The volume label. + :vartype label: str + :ivar name: The volume name. + :vartype name: str """ _attribute_map = { - 'label': {'key': 'label', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + "label": {"key": "label", "type": "str"}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - label: Optional[str] = None, - name: Optional[str] = None, - **kwargs - ): - super(DiskVolumeDetails, self).__init__(**kwargs) + def __init__(self, *, label: Optional[str] = None, name: Optional[str] = None, **kwargs): + """ + :keyword label: The volume label. + :paramtype label: str + :keyword name: The volume name. + :paramtype name: str + """ + super().__init__(**kwargs) self.label = label self.name = name -class Display(msrest.serialization.Model): +class Display(_serialization.Model): """Contains the localized display information for this particular operation / action. These value will be used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for the event service; and (3) audit history / records for management operations. - :param provider: The provider. The localized friendly form of the resource provider name - it - is expected to also include the publisher/company responsible. It should use Title Casing and + :ivar provider: The provider. The localized friendly form of the resource provider name - it is + expected to also include the publisher/company responsible. It should use Title Casing and begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or "Microsoft Compute.". - :type provider: str - :param resource: The resource. The localized friendly form of the resource related to this + :vartype provider: str + :ivar resource: The resource. The localized friendly form of the resource related to this action/operation - it should match the public documentation for the resource provider. It should use Title Casing. This value should be unique for a particular URL type (e.g. nested types should *not* reuse their parent's display.resource field). e.g. "Virtual Machines" or "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs". - :type resource: str - :param operation: The operation. The localized friendly name for the operation, as it should be + :vartype resource: str + :ivar operation: The operation. The localized friendly name for the operation, as it should be shown to the user. It should be concise (to fit in drop downs) but clear (i.e. self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update Delete 'ActionName'. - :type operation: str - :param description: The description. The localized friendly description for the operation, as - it should be shown to the user. It should be thorough, yet concise - it will be used in tool - tips and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' - resource Create or Update any 'display.provider' resource Delete any 'display.provider' - resource Perform any other action on any 'display.provider' resource Prescriptive guidance for - namespaces: Read any 'display.resource' Create or Update any 'display.resource' Delete any - 'display.resource' 'ActionName' any 'display.resources'. - :type description: str + :vartype operation: str + :ivar description: The description. The localized friendly description for the operation, as it + should be shown to the user. It should be thorough, yet concise - it will be used in tool tips + and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' resource + Create or Update any 'display.provider' resource Delete any 'display.provider' resource Perform + any other action on any 'display.provider' resource Prescriptive guidance for namespaces: Read + any 'display.resource' Create or Update any 'display.resource' Delete any 'display.resource' + 'ActionName' any 'display.resources'. + :vartype description: str """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -4888,14 +6212,40 @@ def __init__( description: Optional[str] = None, **kwargs ): - super(Display, self).__init__(**kwargs) + """ + :keyword provider: The provider. The localized friendly form of the resource provider name - it + is expected to also include the publisher/company responsible. It should use Title Casing and + begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or + "Microsoft Compute.". + :paramtype provider: str + :keyword resource: The resource. The localized friendly form of the resource related to this + action/operation - it should match the public documentation for the resource provider. It + should use Title Casing. This value should be unique for a particular URL type (e.g. nested + types should *not* reuse their parent's display.resource field). e.g. "Virtual Machines" or + "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs". + :paramtype resource: str + :keyword operation: The operation. The localized friendly name for the operation, as it should + be shown to the user. It should be concise (to fit in drop downs) but clear (i.e. + self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update + Delete 'ActionName'. + :paramtype operation: str + :keyword description: The description. The localized friendly description for the operation, as + it should be shown to the user. It should be thorough, yet concise - it will be used in tool + tips and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' + resource Create or Update any 'display.provider' resource Delete any 'display.provider' + resource Perform any other action on any 'display.provider' resource Prescriptive guidance for + namespaces: Read any 'display.resource' Create or Update any 'display.resource' Delete any + 'display.resource' 'ActionName' any 'display.resources'. + :paramtype description: str + """ + super().__init__(**kwargs) self.provider = provider self.resource = resource self.operation = operation self.description = description -class DraDetails(msrest.serialization.Model): +class DraDetails(_serialization.Model): """DRA details. Variables are only populated by the server, and will be ignored when sending a request. @@ -4910,7 +6260,7 @@ class DraDetails(msrest.serialization.Model): :vartype version: str :ivar last_heartbeat_utc: The last heartbeat received from the DRA. :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health. Possible values include: "None", "Normal", "Warning", "Critical". + :ivar health: The health. Known values are: "None", "Normal", "Warning", and "Critical". :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth :ivar health_errors: The health errors. :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] @@ -4923,34 +6273,32 @@ class DraDetails(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - 'forward_protected_item_count': {'readonly': True}, - 'reverse_protected_item_count': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "bios_id": {"readonly": True}, + "version": {"readonly": True}, + "last_heartbeat_utc": {"readonly": True}, + "health": {"readonly": True}, + "health_errors": {"readonly": True}, + "forward_protected_item_count": {"readonly": True}, + "reverse_protected_item_count": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'forward_protected_item_count': {'key': 'forwardProtectedItemCount', 'type': 'int'}, - 'reverse_protected_item_count': {'key': 'reverseProtectedItemCount', 'type': 'int'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "health": {"key": "health", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, + "forward_protected_item_count": {"key": "forwardProtectedItemCount", "type": "int"}, + "reverse_protected_item_count": {"key": "reverseProtectedItemCount", "type": "int"}, } - def __init__( - self, - **kwargs - ): - super(DraDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.bios_id = None @@ -4962,140 +6310,142 @@ def __init__( self.reverse_protected_item_count = None -class EnableMigrationInput(msrest.serialization.Model): +class EnableMigrationInput(_serialization.Model): """Enable migration input. All required parameters must be populated in order to send to Azure. - :param properties: Required. Enable migration input properties. - :type properties: + :ivar properties: Enable migration input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'EnableMigrationInputProperties'}, + "properties": {"key": "properties", "type": "EnableMigrationInputProperties"}, } - def __init__( - self, - *, - properties: "EnableMigrationInputProperties", - **kwargs - ): - super(EnableMigrationInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.EnableMigrationInputProperties", **kwargs): + """ + :keyword properties: Enable migration input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class EnableMigrationInputProperties(msrest.serialization.Model): +class EnableMigrationInputProperties(_serialization.Model): """Enable migration input properties. All required parameters must be populated in order to send to Azure. - :param policy_id: Required. The policy Id. - :type policy_id: str - :param provider_specific_details: Required. The provider specific details. - :type provider_specific_details: + :ivar policy_id: The policy Id. Required. + :vartype policy_id: str + :ivar provider_specific_details: The provider specific details. Required. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput """ _validation = { - 'policy_id': {'required': True}, - 'provider_specific_details': {'required': True}, + "policy_id": {"required": True}, + "provider_specific_details": {"required": True}, } _attribute_map = { - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'EnableMigrationProviderSpecificInput'}, + "policy_id": {"key": "policyId", "type": "str"}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "EnableMigrationProviderSpecificInput"}, } def __init__( - self, - *, - policy_id: str, - provider_specific_details: "EnableMigrationProviderSpecificInput", - **kwargs + self, *, policy_id: str, provider_specific_details: "_models.EnableMigrationProviderSpecificInput", **kwargs ): - super(EnableMigrationInputProperties, self).__init__(**kwargs) + """ + :keyword policy_id: The policy Id. Required. + :paramtype policy_id: str + :keyword provider_specific_details: The provider specific details. Required. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput + """ + super().__init__(**kwargs) self.policy_id = policy_id self.provider_specific_details = provider_specific_details -class EnableMigrationProviderSpecificInput(msrest.serialization.Model): +class EnableMigrationProviderSpecificInput(_serialization.Model): """Enable migration provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtEnableMigrationInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtEnableMigrationInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtEnableMigrationInput'} - } + _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtEnableMigrationInput"}} - def __init__( - self, - **kwargs - ): - super(EnableMigrationProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class EnableProtectionInput(msrest.serialization.Model): +class EnableProtectionInput(_serialization.Model): """Enable protection input. - :param properties: Enable protection input properties. - :type properties: + :ivar properties: Enable protection input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'EnableProtectionInputProperties'}, + "properties": {"key": "properties", "type": "EnableProtectionInputProperties"}, } - def __init__( - self, - *, - properties: Optional["EnableProtectionInputProperties"] = None, - **kwargs - ): - super(EnableProtectionInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.EnableProtectionInputProperties"] = None, **kwargs): + """ + :keyword properties: Enable protection input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class EnableProtectionInputProperties(msrest.serialization.Model): +class EnableProtectionInputProperties(_serialization.Model): """Enable protection input properties. - :param policy_id: The Policy Id. - :type policy_id: str - :param protectable_item_id: The protectable item Id. - :type protectable_item_id: str - :param provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure - provider, it will be AzureEnableProtectionInput object. For San provider, it will be + :ivar policy_id: The Policy Id. + :vartype policy_id: str + :ivar protectable_item_id: The protectable item Id. + :vartype protectable_item_id: str + :ivar provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure provider, + it will be AzureEnableProtectionInput object. For San provider, it will be SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :type provider_specific_details: + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput """ _attribute_map = { - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'protectable_item_id': {'key': 'protectableItemId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'EnableProtectionProviderSpecificInput'}, + "policy_id": {"key": "policyId", "type": "str"}, + "protectable_item_id": {"key": "protectableItemId", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "EnableProtectionProviderSpecificInput", + }, } def __init__( @@ -5103,30 +6453,41 @@ def __init__( *, policy_id: Optional[str] = None, protectable_item_id: Optional[str] = None, - provider_specific_details: Optional["EnableProtectionProviderSpecificInput"] = None, - **kwargs - ): - super(EnableProtectionInputProperties, self).__init__(**kwargs) + provider_specific_details: Optional["_models.EnableProtectionProviderSpecificInput"] = None, + **kwargs + ): + """ + :keyword policy_id: The Policy Id. + :paramtype policy_id: str + :keyword protectable_item_id: The protectable item Id. + :paramtype protectable_item_id: str + :keyword provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure + provider, it will be AzureEnableProtectionInput object. For San provider, it will be + SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput + """ + super().__init__(**kwargs) self.policy_id = policy_id self.protectable_item_id = protectable_item_id self.provider_specific_details = provider_specific_details -class EncryptionDetails(msrest.serialization.Model): +class EncryptionDetails(_serialization.Model): """Encryption details for the fabric. - :param kek_state: The key encryption key state for the Vmm. - :type kek_state: str - :param kek_cert_thumbprint: The key encryption key certificate thumbprint. - :type kek_cert_thumbprint: str - :param kek_cert_expiry_date: The key encryption key certificate expiry date. - :type kek_cert_expiry_date: ~datetime.datetime + :ivar kek_state: The key encryption key state for the Vmm. + :vartype kek_state: str + :ivar kek_cert_thumbprint: The key encryption key certificate thumbprint. + :vartype kek_cert_thumbprint: str + :ivar kek_cert_expiry_date: The key encryption key certificate expiry date. + :vartype kek_cert_expiry_date: ~datetime.datetime """ _attribute_map = { - 'kek_state': {'key': 'kekState', 'type': 'str'}, - 'kek_cert_thumbprint': {'key': 'kekCertThumbprint', 'type': 'str'}, - 'kek_cert_expiry_date': {'key': 'kekCertExpiryDate', 'type': 'iso-8601'}, + "kek_state": {"key": "kekState", "type": "str"}, + "kek_cert_thumbprint": {"key": "kekCertThumbprint", "type": "str"}, + "kek_cert_expiry_date": {"key": "kekCertExpiryDate", "type": "iso-8601"}, } def __init__( @@ -5137,7 +6498,15 @@ def __init__( kek_cert_expiry_date: Optional[datetime.datetime] = None, **kwargs ): - super(EncryptionDetails, self).__init__(**kwargs) + """ + :keyword kek_state: The key encryption key state for the Vmm. + :paramtype kek_state: str + :keyword kek_cert_thumbprint: The key encryption key certificate thumbprint. + :paramtype kek_cert_thumbprint: str + :keyword kek_cert_expiry_date: The key encryption key certificate expiry date. + :paramtype kek_cert_expiry_date: ~datetime.datetime + """ + super().__init__(**kwargs) self.kek_state = kek_state self.kek_cert_thumbprint = kek_cert_thumbprint self.kek_cert_expiry_date = kek_cert_expiry_date @@ -5154,107 +6523,109 @@ class Event(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Event related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.EventProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: Event related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.EventProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'EventProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "EventProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["EventProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.EventProperties"] = None, **kwargs ): - super(Event, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: Event related data. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.EventProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class EventCollection(msrest.serialization.Model): +class EventCollection(_serialization.Model): """Collection of fabric details. - :param value: The list of events. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Event] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The list of events. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Event] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Event]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Event]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["Event"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(EventCollection, self).__init__(**kwargs) + def __init__(self, *, value: Optional[List["_models.Event"]] = None, next_link: Optional[str] = None, **kwargs): + """ + :keyword value: The list of events. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Event] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class EventProperties(msrest.serialization.Model): +class EventProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """The properties of a monitoring event. - :param event_code: The Id of the monitoring event. - :type event_code: str - :param description: The event name. - :type description: str - :param event_type: The type of the event. for example: VM Health, Server Health, Job Failure + :ivar event_code: The Id of the monitoring event. + :vartype event_code: str + :ivar description: The event name. + :vartype description: str + :ivar event_type: The type of the event. for example: VM Health, Server Health, Job Failure etc. - :type event_type: str - :param affected_object_friendly_name: The friendly name of the source of the event on which it + :vartype event_type: str + :ivar affected_object_friendly_name: The friendly name of the source of the event on which it is raised (for example, VM, VMM etc). - :type affected_object_friendly_name: str - :param affected_object_correlation_id: The affected object correlationId for the event. - :type affected_object_correlation_id: str - :param severity: The severity of the event. - :type severity: str - :param time_of_occurrence: The time of occurrence of the event. - :type time_of_occurrence: ~datetime.datetime - :param fabric_id: The ARM ID of the fabric. - :type fabric_id: str - :param provider_specific_details: The provider specific settings. - :type provider_specific_details: + :vartype affected_object_friendly_name: str + :ivar affected_object_correlation_id: The affected object correlationId for the event. + :vartype affected_object_correlation_id: str + :ivar severity: The severity of the event. + :vartype severity: str + :ivar time_of_occurrence: The time of occurrence of the event. + :vartype time_of_occurrence: ~datetime.datetime + :ivar fabric_id: The ARM ID of the fabric. + :vartype fabric_id: str + :ivar provider_specific_details: The provider specific settings. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.EventProviderSpecificDetails - :param event_specific_details: The event specific settings. - :type event_specific_details: + :ivar event_specific_details: The event specific settings. + :vartype event_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.EventSpecificDetails - :param health_errors: The list of errors / warnings capturing details associated with the + :ivar health_errors: The list of errors / warnings capturing details associated with the issue(s). - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] """ _attribute_map = { - 'event_code': {'key': 'eventCode', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'event_type': {'key': 'eventType', 'type': 'str'}, - 'affected_object_friendly_name': {'key': 'affectedObjectFriendlyName', 'type': 'str'}, - 'affected_object_correlation_id': {'key': 'affectedObjectCorrelationId', 'type': 'str'}, - 'severity': {'key': 'severity', 'type': 'str'}, - 'time_of_occurrence': {'key': 'timeOfOccurrence', 'type': 'iso-8601'}, - 'fabric_id': {'key': 'fabricId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'EventProviderSpecificDetails'}, - 'event_specific_details': {'key': 'eventSpecificDetails', 'type': 'EventSpecificDetails'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, + "event_code": {"key": "eventCode", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "event_type": {"key": "eventType", "type": "str"}, + "affected_object_friendly_name": {"key": "affectedObjectFriendlyName", "type": "str"}, + "affected_object_correlation_id": {"key": "affectedObjectCorrelationId", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "time_of_occurrence": {"key": "timeOfOccurrence", "type": "iso-8601"}, + "fabric_id": {"key": "fabricId", "type": "str"}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "EventProviderSpecificDetails"}, + "event_specific_details": {"key": "eventSpecificDetails", "type": "EventSpecificDetails"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, } def __init__( @@ -5268,12 +6639,41 @@ def __init__( severity: Optional[str] = None, time_of_occurrence: Optional[datetime.datetime] = None, fabric_id: Optional[str] = None, - provider_specific_details: Optional["EventProviderSpecificDetails"] = None, - event_specific_details: Optional["EventSpecificDetails"] = None, - health_errors: Optional[List["HealthError"]] = None, - **kwargs - ): - super(EventProperties, self).__init__(**kwargs) + provider_specific_details: Optional["_models.EventProviderSpecificDetails"] = None, + event_specific_details: Optional["_models.EventSpecificDetails"] = None, + health_errors: Optional[List["_models.HealthError"]] = None, + **kwargs + ): + """ + :keyword event_code: The Id of the monitoring event. + :paramtype event_code: str + :keyword description: The event name. + :paramtype description: str + :keyword event_type: The type of the event. for example: VM Health, Server Health, Job Failure + etc. + :paramtype event_type: str + :keyword affected_object_friendly_name: The friendly name of the source of the event on which + it is raised (for example, VM, VMM etc). + :paramtype affected_object_friendly_name: str + :keyword affected_object_correlation_id: The affected object correlationId for the event. + :paramtype affected_object_correlation_id: str + :keyword severity: The severity of the event. + :paramtype severity: str + :keyword time_of_occurrence: The time of occurrence of the event. + :paramtype time_of_occurrence: ~datetime.datetime + :keyword fabric_id: The ARM ID of the fabric. + :paramtype fabric_id: str + :keyword provider_specific_details: The provider specific settings. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EventProviderSpecificDetails + :keyword event_specific_details: The event specific settings. + :paramtype event_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EventSpecificDetails + :keyword health_errors: The list of errors / warnings capturing details associated with the + issue(s). + :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + super().__init__(**kwargs) self.event_code = event_code self.description = description self.event_type = event_type @@ -5287,37 +6687,37 @@ def __init__( self.health_errors = health_errors -class EventQueryParameter(msrest.serialization.Model): +class EventQueryParameter(_serialization.Model): """Implements the event query parameter. - :param event_code: The source id of the events to be queried. - :type event_code: str - :param severity: The severity of the events to be queried. - :type severity: str - :param event_type: The type of the events to be queried. - :type event_type: str - :param fabric_name: The affected object server id of the events to be queried. - :type fabric_name: str - :param affected_object_friendly_name: The affected object name of the events to be queried. - :type affected_object_friendly_name: str - :param affected_object_correlation_id: The affected object correlationId for the events to be + :ivar event_code: The source id of the events to be queried. + :vartype event_code: str + :ivar severity: The severity of the events to be queried. + :vartype severity: str + :ivar event_type: The type of the events to be queried. + :vartype event_type: str + :ivar fabric_name: The affected object server id of the events to be queried. + :vartype fabric_name: str + :ivar affected_object_friendly_name: The affected object name of the events to be queried. + :vartype affected_object_friendly_name: str + :ivar affected_object_correlation_id: The affected object correlationId for the events to be queried. - :type affected_object_correlation_id: str - :param start_time: The start time of the time range within which the events are to be queried. - :type start_time: ~datetime.datetime - :param end_time: The end time of the time range within which the events are to be queried. - :type end_time: ~datetime.datetime + :vartype affected_object_correlation_id: str + :ivar start_time: The start time of the time range within which the events are to be queried. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the time range within which the events are to be queried. + :vartype end_time: ~datetime.datetime """ _attribute_map = { - 'event_code': {'key': 'eventCode', 'type': 'str'}, - 'severity': {'key': 'severity', 'type': 'str'}, - 'event_type': {'key': 'eventType', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'affected_object_friendly_name': {'key': 'affectedObjectFriendlyName', 'type': 'str'}, - 'affected_object_correlation_id': {'key': 'affectedObjectCorrelationId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + "event_code": {"key": "eventCode", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "event_type": {"key": "eventType", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "affected_object_friendly_name": {"key": "affectedObjectFriendlyName", "type": "str"}, + "affected_object_correlation_id": {"key": "affectedObjectCorrelationId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, } def __init__( @@ -5333,7 +6733,27 @@ def __init__( end_time: Optional[datetime.datetime] = None, **kwargs ): - super(EventQueryParameter, self).__init__(**kwargs) + """ + :keyword event_code: The source id of the events to be queried. + :paramtype event_code: str + :keyword severity: The severity of the events to be queried. + :paramtype severity: str + :keyword event_type: The type of the events to be queried. + :paramtype event_type: str + :keyword fabric_name: The affected object server id of the events to be queried. + :paramtype fabric_name: str + :keyword affected_object_friendly_name: The affected object name of the events to be queried. + :paramtype affected_object_friendly_name: str + :keyword affected_object_correlation_id: The affected object correlationId for the events to be + queried. + :paramtype affected_object_correlation_id: str + :keyword start_time: The start time of the time range within which the events are to be + queried. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the time range within which the events are to be queried. + :paramtype end_time: ~datetime.datetime + """ + super().__init__(**kwargs) self.event_code = event_code self.severity = severity self.event_type = event_type @@ -5344,68 +6764,59 @@ def __init__( self.end_time = end_time -class EventSpecificDetails(msrest.serialization.Model): +class EventSpecificDetails(_serialization.Model): """Model class for event specific details for an event. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JobStatusEventDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + JobStatusEventDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'JobStatus': 'JobStatusEventDetails'} - } + _subtype_map = {"instance_type": {"JobStatus": "JobStatusEventDetails"}} - def __init__( - self, - **kwargs - ): - super(EventSpecificDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class ProtectionProfileCustomDetails(msrest.serialization.Model): +class ProtectionProfileCustomDetails(_serialization.Model): """Protection Profile custom input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingProtectionProfile, NewProtectionProfile. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingProtectionProfile, NewProtectionProfile All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, } - _subtype_map = { - 'resource_type': {'Existing': 'ExistingProtectionProfile', 'New': 'NewProtectionProfile'} - } + _subtype_map = {"resource_type": {"Existing": "ExistingProtectionProfile", "New": "NewProtectionProfile"}} - def __init__( - self, - **kwargs - ): - super(ProtectionProfileCustomDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.resource_type = None # type: Optional[str] @@ -5414,63 +6825,59 @@ class ExistingProtectionProfile(ProtectionProfileCustomDetails): All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param protection_profile_id: Required. The protection profile Arm Id. Throw error, if resource - does not exists. - :type protection_profile_id: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str + :ivar protection_profile_id: The protection profile Arm Id. Throw error, if resource does not + exists. Required. + :vartype protection_profile_id: str """ _validation = { - 'resource_type': {'required': True}, - 'protection_profile_id': {'required': True}, + "resource_type": {"required": True}, + "protection_profile_id": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'protection_profile_id': {'key': 'protectionProfileId', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "protection_profile_id": {"key": "protectionProfileId", "type": "str"}, } - def __init__( - self, - *, - protection_profile_id: str, - **kwargs - ): - super(ExistingProtectionProfile, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str + def __init__(self, *, protection_profile_id: str, **kwargs): + """ + :keyword protection_profile_id: The protection profile Arm Id. Throw error, if resource does + not exists. Required. + :paramtype protection_profile_id: str + """ + super().__init__(**kwargs) + self.resource_type = "Existing" # type: str self.protection_profile_id = protection_profile_id -class RecoveryAvailabilitySetCustomDetails(msrest.serialization.Model): +class RecoveryAvailabilitySetCustomDetails(_serialization.Model): """Recovery Availability Set custom input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingRecoveryAvailabilitySet. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingRecoveryAvailabilitySet All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, } - _subtype_map = { - 'resource_type': {'Existing': 'ExistingRecoveryAvailabilitySet'} - } + _subtype_map = {"resource_type": {"Existing": "ExistingRecoveryAvailabilitySet"}} - def __init__( - self, - **kwargs - ): - super(RecoveryAvailabilitySetCustomDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.resource_type = None # type: Optional[str] @@ -5479,62 +6886,58 @@ class ExistingRecoveryAvailabilitySet(RecoveryAvailabilitySetCustomDetails): All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_availability_set_id: The recovery availability set Id. Will throw error, if + :ivar resource_type: The class type. Required. + :vartype resource_type: str + :ivar recovery_availability_set_id: The recovery availability set Id. Will throw error, if resource does not exist. - :type recovery_availability_set_id: str + :vartype recovery_availability_set_id: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, } - def __init__( - self, - *, - recovery_availability_set_id: Optional[str] = None, - **kwargs - ): - super(ExistingRecoveryAvailabilitySet, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str + def __init__(self, *, recovery_availability_set_id: Optional[str] = None, **kwargs): + """ + :keyword recovery_availability_set_id: The recovery availability set Id. Will throw error, if + resource does not exist. + :paramtype recovery_availability_set_id: str + """ + super().__init__(**kwargs) + self.resource_type = "Existing" # type: str self.recovery_availability_set_id = recovery_availability_set_id -class RecoveryProximityPlacementGroupCustomDetails(msrest.serialization.Model): +class RecoveryProximityPlacementGroupCustomDetails(_serialization.Model): """Recovery Proximity placement group custom input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingRecoveryProximityPlacementGroup. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingRecoveryProximityPlacementGroup All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, } - _subtype_map = { - 'resource_type': {'Existing': 'ExistingRecoveryProximityPlacementGroup'} - } + _subtype_map = {"resource_type": {"Existing": "ExistingRecoveryProximityPlacementGroup"}} - def __init__( - self, - **kwargs - ): - super(RecoveryProximityPlacementGroupCustomDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.resource_type = None # type: Optional[str] @@ -5543,62 +6946,58 @@ class ExistingRecoveryProximityPlacementGroup(RecoveryProximityPlacementGroupCus All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_proximity_placement_group_id: The recovery proximity placement group Id. Will + :ivar resource_type: The class type. Required. + :vartype resource_type: str + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. Will throw error, if resource does not exist. - :type recovery_proximity_placement_group_id: str + :vartype recovery_proximity_placement_group_id: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_proximity_placement_group_id': {'key': 'recoveryProximityPlacementGroupId', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, } - def __init__( - self, - *, - recovery_proximity_placement_group_id: Optional[str] = None, - **kwargs - ): - super(ExistingRecoveryProximityPlacementGroup, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str + def __init__(self, *, recovery_proximity_placement_group_id: Optional[str] = None, **kwargs): + """ + :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. Will + throw error, if resource does not exist. + :paramtype recovery_proximity_placement_group_id: str + """ + super().__init__(**kwargs) + self.resource_type = "Existing" # type: str self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id -class RecoveryResourceGroupCustomDetails(msrest.serialization.Model): +class RecoveryResourceGroupCustomDetails(_serialization.Model): """Recovery Resource Group custom input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingRecoveryResourceGroup. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingRecoveryResourceGroup All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, } - _subtype_map = { - 'resource_type': {'Existing': 'ExistingRecoveryResourceGroup'} - } + _subtype_map = {"resource_type": {"Existing": "ExistingRecoveryResourceGroup"}} - def __init__( - self, - **kwargs - ): - super(RecoveryResourceGroupCustomDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.resource_type = None # type: Optional[str] @@ -5607,61 +7006,56 @@ class ExistingRecoveryResourceGroup(RecoveryResourceGroupCustomDetails): All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :type recovery_resource_group_id: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :vartype recovery_resource_group_id: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_resource_group_id': {'key': 'recoveryResourceGroupId', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, } - def __init__( - self, - *, - recovery_resource_group_id: Optional[str] = None, - **kwargs - ): - super(ExistingRecoveryResourceGroup, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str + def __init__(self, *, recovery_resource_group_id: Optional[str] = None, **kwargs): + """ + :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :paramtype recovery_resource_group_id: str + """ + super().__init__(**kwargs) + self.resource_type = "Existing" # type: str self.recovery_resource_group_id = recovery_resource_group_id -class RecoveryVirtualNetworkCustomDetails(msrest.serialization.Model): +class RecoveryVirtualNetworkCustomDetails(_serialization.Model): """Recovery Virtual network custom input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingRecoveryVirtualNetwork, NewRecoveryVirtualNetwork. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingRecoveryVirtualNetwork, NewRecoveryVirtualNetwork All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, } - _subtype_map = { - 'resource_type': {'Existing': 'ExistingRecoveryVirtualNetwork', 'New': 'NewRecoveryVirtualNetwork'} - } + _subtype_map = {"resource_type": {"Existing": "ExistingRecoveryVirtualNetwork", "New": "NewRecoveryVirtualNetwork"}} - def __init__( - self, - **kwargs - ): - super(RecoveryVirtualNetworkCustomDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.resource_type = None # type: Optional[str] @@ -5670,68 +7064,65 @@ class ExistingRecoveryVirtualNetwork(RecoveryVirtualNetworkCustomDetails): All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_virtual_network_id: Required. The recovery virtual network Id. Will throw - error, if resource does not exist. - :type recovery_virtual_network_id: str - :param recovery_subnet_name: The recovery subnet name. - :type recovery_subnet_name: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str + :ivar recovery_virtual_network_id: The recovery virtual network Id. Will throw error, if + resource does not exist. Required. + :vartype recovery_virtual_network_id: str + :ivar recovery_subnet_name: The recovery subnet name. + :vartype recovery_subnet_name: str """ _validation = { - 'resource_type': {'required': True}, - 'recovery_virtual_network_id': {'required': True}, + "resource_type": {"required": True}, + "recovery_virtual_network_id": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_virtual_network_id': {'key': 'recoveryVirtualNetworkId', 'type': 'str'}, - 'recovery_subnet_name': {'key': 'recoverySubnetName', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "recovery_virtual_network_id": {"key": "recoveryVirtualNetworkId", "type": "str"}, + "recovery_subnet_name": {"key": "recoverySubnetName", "type": "str"}, } - def __init__( - self, - *, - recovery_virtual_network_id: str, - recovery_subnet_name: Optional[str] = None, - **kwargs - ): - super(ExistingRecoveryVirtualNetwork, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str + def __init__(self, *, recovery_virtual_network_id: str, recovery_subnet_name: Optional[str] = None, **kwargs): + """ + :keyword recovery_virtual_network_id: The recovery virtual network Id. Will throw error, if + resource does not exist. Required. + :paramtype recovery_virtual_network_id: str + :keyword recovery_subnet_name: The recovery subnet name. + :paramtype recovery_subnet_name: str + """ + super().__init__(**kwargs) + self.resource_type = "Existing" # type: str self.recovery_virtual_network_id = recovery_virtual_network_id self.recovery_subnet_name = recovery_subnet_name -class StorageAccountCustomDetails(msrest.serialization.Model): +class StorageAccountCustomDetails(_serialization.Model): """Storage account custom input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExistingStorageAccount. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingStorageAccount All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, } - _subtype_map = { - 'resource_type': {'Existing': 'ExistingStorageAccount'} - } + _subtype_map = {"resource_type": {"Existing": "ExistingStorageAccount"}} - def __init__( - self, - **kwargs - ): - super(StorageAccountCustomDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.resource_type = None # type: Optional[str] @@ -5740,31 +7131,31 @@ class ExistingStorageAccount(StorageAccountCustomDetails): All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param azure_storage_account_id: Required. The storage account Arm Id. Throw error, if resource - does not exists. - :type azure_storage_account_id: str + :ivar resource_type: The class type. Required. + :vartype resource_type: str + :ivar azure_storage_account_id: The storage account Arm Id. Throw error, if resource does not + exists. Required. + :vartype azure_storage_account_id: str """ _validation = { - 'resource_type': {'required': True}, - 'azure_storage_account_id': {'required': True}, + "resource_type": {"required": True}, + "azure_storage_account_id": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'azure_storage_account_id': {'key': 'azureStorageAccountId', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "azure_storage_account_id": {"key": "azureStorageAccountId", "type": "str"}, } - def __init__( - self, - *, - azure_storage_account_id: str, - **kwargs - ): - super(ExistingStorageAccount, self).__init__(**kwargs) - self.resource_type = 'Existing' # type: str + def __init__(self, *, azure_storage_account_id: str, **kwargs): + """ + :keyword azure_storage_account_id: The storage account Arm Id. Throw error, if resource does + not exists. Required. + :paramtype azure_storage_account_id: str + """ + super().__init__(**kwargs) + self.resource_type = "Existing" # type: str self.azure_storage_account_id = azure_storage_account_id @@ -5773,27 +7164,27 @@ class ExportJobDetails(JobDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - :param blob_uri: BlobUri of the exported jobs. - :type blob_uri: str - :param sas_token: The sas token to access blob. - :type sas_token: str + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. + :vartype instance_type: str + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar blob_uri: BlobUri of the exported jobs. + :vartype blob_uri: str + :ivar sas_token: The sas token to access blob. + :vartype sas_token: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - 'blob_uri': {'key': 'blobUri', 'type': 'str'}, - 'sas_token': {'key': 'sasToken', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, + "blob_uri": {"key": "blobUri", "type": "str"}, + "sas_token": {"key": "sasToken", "type": "str"}, } def __init__( @@ -5804,12 +7195,54 @@ def __init__( sas_token: Optional[str] = None, **kwargs ): - super(ExportJobDetails, self).__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type = 'ExportJobDetails' # type: str + """ + :keyword affected_object_details: The affected object properties like source server, source + cloud, target server, target cloud etc. based on the workflow object details. + :paramtype affected_object_details: dict[str, str] + :keyword blob_uri: BlobUri of the exported jobs. + :paramtype blob_uri: str + :keyword sas_token: The sas token to access blob. + :paramtype sas_token: str + """ + super().__init__(affected_object_details=affected_object_details, **kwargs) + self.instance_type = "ExportJobDetails" # type: str self.blob_uri = blob_uri self.sas_token = sas_token +class ExtendedLocation(_serialization.Model): + """Extended location of the resource. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the extended location. Required. + :vartype name: str + :ivar type: The extended location type. Required. "EdgeZone" + :vartype type: str or ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocationType + """ + + _validation = { + "name": {"required": True}, + "type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, name: str, type: Union[str, "_models.ExtendedLocationType"], **kwargs): + """ + :keyword name: The name of the extended location. Required. + :paramtype name: str + :keyword type: The extended location type. Required. "EdgeZone" + :paramtype type: str or ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocationType + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + class Fabric(Resource): """Fabric definition. @@ -5821,153 +7254,179 @@ class Fabric(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Fabric related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.FabricProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: Fabric related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.FabricProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'FabricProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "FabricProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["FabricProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.FabricProperties"] = None, **kwargs ): - super(Fabric, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: Fabric related data. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.FabricProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class FabricCollection(msrest.serialization.Model): +class FabricCollection(_serialization.Model): """Collection of fabric details. - :param value: The fabric details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The fabric details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Fabric]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Fabric]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["Fabric"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(FabricCollection, self).__init__(**kwargs) + def __init__(self, *, value: Optional[List["_models.Fabric"]] = None, next_link: Optional[str] = None, **kwargs): + """ + :keyword value: The fabric details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class FabricCreationInput(msrest.serialization.Model): +class FabricCreationInput(_serialization.Model): """Site details provided during the time of site creation. - :param properties: Fabric creation input. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInputProperties + :ivar properties: Fabric creation input. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'FabricCreationInputProperties'}, + "properties": {"key": "properties", "type": "FabricCreationInputProperties"}, } - def __init__( - self, - *, - properties: Optional["FabricCreationInputProperties"] = None, - **kwargs - ): - super(FabricCreationInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.FabricCreationInputProperties"] = None, **kwargs): + """ + :keyword properties: Fabric creation input. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class FabricCreationInputProperties(msrest.serialization.Model): +class FabricCreationInputProperties(_serialization.Model): """Properties of site details provided during the time of site creation. - :param custom_details: Fabric provider specific creation input. - :type custom_details: + :ivar custom_details: Fabric provider specific creation input. + :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreationInput """ _attribute_map = { - 'custom_details': {'key': 'customDetails', 'type': 'FabricSpecificCreationInput'}, + "custom_details": {"key": "customDetails", "type": "FabricSpecificCreationInput"}, } - def __init__( - self, - *, - custom_details: Optional["FabricSpecificCreationInput"] = None, - **kwargs - ): - super(FabricCreationInputProperties, self).__init__(**kwargs) + def __init__(self, *, custom_details: Optional["_models.FabricSpecificCreationInput"] = None, **kwargs): + """ + :keyword custom_details: Fabric provider specific creation input. + :paramtype custom_details: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreationInput + """ + super().__init__(**kwargs) self.custom_details = custom_details -class FabricProperties(msrest.serialization.Model): +class FabricProperties(_serialization.Model): """Fabric properties. - :param friendly_name: Friendly name of the fabric. - :type friendly_name: str - :param encryption_details: Encryption details for the fabric. - :type encryption_details: ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails - :param rollover_encryption_details: Rollover encryption details for the fabric. - :type rollover_encryption_details: + :ivar friendly_name: Friendly name of the fabric. + :vartype friendly_name: str + :ivar encryption_details: Encryption details for the fabric. + :vartype encryption_details: ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails + :ivar rollover_encryption_details: Rollover encryption details for the fabric. + :vartype rollover_encryption_details: ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails - :param internal_identifier: Dra Registration Id. - :type internal_identifier: str - :param bcdr_state: BCDR state of the fabric. - :type bcdr_state: str - :param custom_details: Fabric specific settings. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificDetails - :param health_error_details: Fabric health error details. - :type health_error_details: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param health: Health of fabric. - :type health: str + :ivar internal_identifier: Dra Registration Id. + :vartype internal_identifier: str + :ivar bcdr_state: BCDR state of the fabric. + :vartype bcdr_state: str + :ivar custom_details: Fabric specific settings. + :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificDetails + :ivar health_error_details: Fabric health error details. + :vartype health_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar health: Health of fabric. + :vartype health: str """ _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'encryption_details': {'key': 'encryptionDetails', 'type': 'EncryptionDetails'}, - 'rollover_encryption_details': {'key': 'rolloverEncryptionDetails', 'type': 'EncryptionDetails'}, - 'internal_identifier': {'key': 'internalIdentifier', 'type': 'str'}, - 'bcdr_state': {'key': 'bcdrState', 'type': 'str'}, - 'custom_details': {'key': 'customDetails', 'type': 'FabricSpecificDetails'}, - 'health_error_details': {'key': 'healthErrorDetails', 'type': '[HealthError]'}, - 'health': {'key': 'health', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "encryption_details": {"key": "encryptionDetails", "type": "EncryptionDetails"}, + "rollover_encryption_details": {"key": "rolloverEncryptionDetails", "type": "EncryptionDetails"}, + "internal_identifier": {"key": "internalIdentifier", "type": "str"}, + "bcdr_state": {"key": "bcdrState", "type": "str"}, + "custom_details": {"key": "customDetails", "type": "FabricSpecificDetails"}, + "health_error_details": {"key": "healthErrorDetails", "type": "[HealthError]"}, + "health": {"key": "health", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - encryption_details: Optional["EncryptionDetails"] = None, - rollover_encryption_details: Optional["EncryptionDetails"] = None, + encryption_details: Optional["_models.EncryptionDetails"] = None, + rollover_encryption_details: Optional["_models.EncryptionDetails"] = None, internal_identifier: Optional[str] = None, bcdr_state: Optional[str] = None, - custom_details: Optional["FabricSpecificDetails"] = None, - health_error_details: Optional[List["HealthError"]] = None, + custom_details: Optional["_models.FabricSpecificDetails"] = None, + health_error_details: Optional[List["_models.HealthError"]] = None, health: Optional[str] = None, **kwargs ): - super(FabricProperties, self).__init__(**kwargs) + """ + :keyword friendly_name: Friendly name of the fabric. + :paramtype friendly_name: str + :keyword encryption_details: Encryption details for the fabric. + :paramtype encryption_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails + :keyword rollover_encryption_details: Rollover encryption details for the fabric. + :paramtype rollover_encryption_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails + :keyword internal_identifier: Dra Registration Id. + :paramtype internal_identifier: str + :keyword bcdr_state: BCDR state of the fabric. + :paramtype bcdr_state: str + :keyword custom_details: Fabric specific settings. + :paramtype custom_details: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificDetails + :keyword health_error_details: Fabric health error details. + :paramtype health_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword health: Health of fabric. + :paramtype health: str + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.encryption_details = encryption_details self.rollover_encryption_details = rollover_encryption_details @@ -5978,32 +7437,31 @@ def __init__( self.health = health -class FabricQueryParameter(msrest.serialization.Model): +class FabricQueryParameter(_serialization.Model): """Query parameter to get fabric. - :param zone_to_zone_mappings: A value indicating whether the zone to zone mappings are to be + :ivar zone_to_zone_mappings: A value indicating whether the zone to zone mappings are to be returned. - :type zone_to_zone_mappings: str - :param fetch_agent_details: A value indicating whether the agent details are to be fetched. - :type fetch_agent_details: str - :param bios_id: The BIOS Id to be used for fetching agent details. - :type bios_id: str - :param fqdn: The FQDN to be used for fetching agent details. - :type fqdn: str - :param discovery_type: The type of the discovered machine to be used for fetching agent - details. - :type discovery_type: str - :param os_type: The OS type to be used for fetching agent details. - :type os_type: str + :vartype zone_to_zone_mappings: str + :ivar fetch_agent_details: A value indicating whether the agent details are to be fetched. + :vartype fetch_agent_details: str + :ivar bios_id: The BIOS Id to be used for fetching agent details. + :vartype bios_id: str + :ivar fqdn: The FQDN to be used for fetching agent details. + :vartype fqdn: str + :ivar discovery_type: The type of the discovered machine to be used for fetching agent details. + :vartype discovery_type: str + :ivar os_type: The OS type to be used for fetching agent details. + :vartype os_type: str """ _attribute_map = { - 'zone_to_zone_mappings': {'key': 'zoneToZoneMappings', 'type': 'str'}, - 'fetch_agent_details': {'key': 'fetchAgentDetails', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, + "zone_to_zone_mappings": {"key": "zoneToZoneMappings", "type": "str"}, + "fetch_agent_details": {"key": "fetchAgentDetails", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "discovery_type": {"key": "discoveryType", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, } def __init__( @@ -6017,7 +7475,23 @@ def __init__( os_type: Optional[str] = None, **kwargs ): - super(FabricQueryParameter, self).__init__(**kwargs) + """ + :keyword zone_to_zone_mappings: A value indicating whether the zone to zone mappings are to be + returned. + :paramtype zone_to_zone_mappings: str + :keyword fetch_agent_details: A value indicating whether the agent details are to be fetched. + :paramtype fetch_agent_details: str + :keyword bios_id: The BIOS Id to be used for fetching agent details. + :paramtype bios_id: str + :keyword fqdn: The FQDN to be used for fetching agent details. + :paramtype fqdn: str + :keyword discovery_type: The type of the discovered machine to be used for fetching agent + details. + :paramtype discovery_type: str + :keyword os_type: The OS type to be used for fetching agent details. + :paramtype os_type: str + """ + super().__init__(**kwargs) self.zone_to_zone_mappings = zone_to_zone_mappings self.fetch_agent_details = fetch_agent_details self.bios_id = bios_id @@ -6029,39 +7503,41 @@ def __init__( class JobTaskDetails(TaskTypeDetails): """This class represents a task which is actually a workflow so that one can navigate to its individual drill down. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FabricReplicationGroupTaskDetails, VirtualMachineTaskDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FabricReplicationGroupTaskDetails, VirtualMachineTaskDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param job_task: The job entity. - :type job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar job_task: The job entity. + :vartype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'job_task': {'key': 'jobTask', 'type': 'JobEntity'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "job_task": {"key": "jobTask", "type": "JobEntity"}, } _subtype_map = { - 'instance_type': {'FabricReplicationGroupTaskDetails': 'FabricReplicationGroupTaskDetails', 'VirtualMachineTaskDetails': 'VirtualMachineTaskDetails'} - } - - def __init__( - self, - *, - job_task: Optional["JobEntity"] = None, - **kwargs - ): - super(JobTaskDetails, self).__init__(**kwargs) - self.instance_type = 'JobTaskDetails' # type: str - self.job_task = job_task + "instance_type": { + "FabricReplicationGroupTaskDetails": "FabricReplicationGroupTaskDetails", + "VirtualMachineTaskDetails": "VirtualMachineTaskDetails", + } + } + + def __init__(self, *, job_task: Optional["_models.JobEntity"] = None, **kwargs): + """ + :keyword job_task: The job entity. + :paramtype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity + """ + super().__init__(**kwargs) + self.instance_type = "JobTaskDetails" # type: str + self.job_task = job_task class FabricReplicationGroupTaskDetails(JobTaskDetails): @@ -6069,37 +7545,45 @@ class FabricReplicationGroupTaskDetails(JobTaskDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param job_task: The job entity. - :type job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - :param skipped_reason: The skipped reason. - :type skipped_reason: str - :param skipped_reason_string: The skipped reason string. - :type skipped_reason_string: str + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar job_task: The job entity. + :vartype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity + :ivar skipped_reason: The skipped reason. + :vartype skipped_reason: str + :ivar skipped_reason_string: The skipped reason string. + :vartype skipped_reason_string: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'job_task': {'key': 'jobTask', 'type': 'JobEntity'}, - 'skipped_reason': {'key': 'skippedReason', 'type': 'str'}, - 'skipped_reason_string': {'key': 'skippedReasonString', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "job_task": {"key": "jobTask", "type": "JobEntity"}, + "skipped_reason": {"key": "skippedReason", "type": "str"}, + "skipped_reason_string": {"key": "skippedReasonString", "type": "str"}, } def __init__( self, *, - job_task: Optional["JobEntity"] = None, + job_task: Optional["_models.JobEntity"] = None, skipped_reason: Optional[str] = None, skipped_reason_string: Optional[str] = None, **kwargs ): - super(FabricReplicationGroupTaskDetails, self).__init__(job_task=job_task, **kwargs) - self.instance_type = 'FabricReplicationGroupTaskDetails' # type: str + """ + :keyword job_task: The job entity. + :paramtype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity + :keyword skipped_reason: The skipped reason. + :paramtype skipped_reason: str + :keyword skipped_reason_string: The skipped reason string. + :paramtype skipped_reason_string: str + """ + super().__init__(job_task=job_task, **kwargs) + self.instance_type = "FabricReplicationGroupTaskDetails" # type: str self.skipped_reason = skipped_reason self.skipped_reason_string = skipped_reason_string @@ -6109,82 +7593,90 @@ class FailoverJobDetails(JobDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - :param protected_item_details: The test VM details. - :type protected_item_details: + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. + :vartype instance_type: str + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar protected_item_details: The test VM details. + :vartype protected_item_details: list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - 'protected_item_details': {'key': 'protectedItemDetails', 'type': '[FailoverReplicationProtectedItemDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, + "protected_item_details": {"key": "protectedItemDetails", "type": "[FailoverReplicationProtectedItemDetails]"}, } def __init__( self, *, affected_object_details: Optional[Dict[str, str]] = None, - protected_item_details: Optional[List["FailoverReplicationProtectedItemDetails"]] = None, - **kwargs - ): - super(FailoverJobDetails, self).__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type = 'FailoverJobDetails' # type: str + protected_item_details: Optional[List["_models.FailoverReplicationProtectedItemDetails"]] = None, + **kwargs + ): + """ + :keyword affected_object_details: The affected object properties like source server, source + cloud, target server, target cloud etc. based on the workflow object details. + :paramtype affected_object_details: dict[str, str] + :keyword protected_item_details: The test VM details. + :paramtype protected_item_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] + """ + super().__init__(affected_object_details=affected_object_details, **kwargs) + self.instance_type = "FailoverJobDetails" # type: str self.protected_item_details = protected_item_details -class FailoverProcessServerRequest(msrest.serialization.Model): +class FailoverProcessServerRequest(_serialization.Model): """Request to failover a process server. - :param properties: The properties of the PS Failover request. - :type properties: + :ivar properties: The properties of the PS Failover request. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequestProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'FailoverProcessServerRequestProperties'}, + "properties": {"key": "properties", "type": "FailoverProcessServerRequestProperties"}, } - def __init__( - self, - *, - properties: Optional["FailoverProcessServerRequestProperties"] = None, - **kwargs - ): - super(FailoverProcessServerRequest, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.FailoverProcessServerRequestProperties"] = None, **kwargs): + """ + :keyword properties: The properties of the PS Failover request. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequestProperties + """ + super().__init__(**kwargs) self.properties = properties -class FailoverProcessServerRequestProperties(msrest.serialization.Model): +class FailoverProcessServerRequestProperties(_serialization.Model): """The properties of the Failover Process Server request. - :param container_name: The container identifier. - :type container_name: str - :param source_process_server_id: The source process server. - :type source_process_server_id: str - :param target_process_server_id: The new process server. - :type target_process_server_id: str - :param vms_to_migrate: The VMS to migrate. - :type vms_to_migrate: list[str] - :param update_type: A value for failover type. It can be systemlevel/serverlevel. - :type update_type: str + :ivar container_name: The container identifier. + :vartype container_name: str + :ivar source_process_server_id: The source process server. + :vartype source_process_server_id: str + :ivar target_process_server_id: The new process server. + :vartype target_process_server_id: str + :ivar vms_to_migrate: The VMS to migrate. + :vartype vms_to_migrate: list[str] + :ivar update_type: A value for failover type. It can be systemlevel/serverlevel. + :vartype update_type: str """ _attribute_map = { - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_process_server_id': {'key': 'sourceProcessServerId', 'type': 'str'}, - 'target_process_server_id': {'key': 'targetProcessServerId', 'type': 'str'}, - 'vms_to_migrate': {'key': 'vmsToMigrate', 'type': '[str]'}, - 'update_type': {'key': 'updateType', 'type': 'str'}, + "container_name": {"key": "containerName", "type": "str"}, + "source_process_server_id": {"key": "sourceProcessServerId", "type": "str"}, + "target_process_server_id": {"key": "targetProcessServerId", "type": "str"}, + "vms_to_migrate": {"key": "vmsToMigrate", "type": "[str]"}, + "update_type": {"key": "updateType", "type": "str"}, } def __init__( @@ -6197,7 +7689,19 @@ def __init__( update_type: Optional[str] = None, **kwargs ): - super(FailoverProcessServerRequestProperties, self).__init__(**kwargs) + """ + :keyword container_name: The container identifier. + :paramtype container_name: str + :keyword source_process_server_id: The source process server. + :paramtype source_process_server_id: str + :keyword target_process_server_id: The new process server. + :paramtype target_process_server_id: str + :keyword vms_to_migrate: The VMS to migrate. + :paramtype vms_to_migrate: list[str] + :keyword update_type: A value for failover type. It can be systemlevel/serverlevel. + :paramtype update_type: str + """ + super().__init__(**kwargs) self.container_name = container_name self.source_process_server_id = source_process_server_id self.target_process_server_id = target_process_server_id @@ -6205,39 +7709,39 @@ def __init__( self.update_type = update_type -class FailoverReplicationProtectedItemDetails(msrest.serialization.Model): +class FailoverReplicationProtectedItemDetails(_serialization.Model): """Failover details for a replication protected item. - :param name: The name. - :type name: str - :param friendly_name: The friendly name. - :type friendly_name: str - :param test_vm_name: The test Vm name. - :type test_vm_name: str - :param test_vm_friendly_name: The test Vm friendly name. - :type test_vm_friendly_name: str - :param network_connection_status: The network connection status. - :type network_connection_status: str - :param network_friendly_name: The network friendly name. - :type network_friendly_name: str - :param subnet: The network subnet. - :type subnet: str - :param recovery_point_id: The recovery point Id. - :type recovery_point_id: str - :param recovery_point_time: The recovery point time. - :type recovery_point_time: ~datetime.datetime - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'test_vm_name': {'key': 'testVmName', 'type': 'str'}, - 'test_vm_friendly_name': {'key': 'testVmFriendlyName', 'type': 'str'}, - 'network_connection_status': {'key': 'networkConnectionStatus', 'type': 'str'}, - 'network_friendly_name': {'key': 'networkFriendlyName', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, + :ivar name: The name. + :vartype name: str + :ivar friendly_name: The friendly name. + :vartype friendly_name: str + :ivar test_vm_name: The test Vm name. + :vartype test_vm_name: str + :ivar test_vm_friendly_name: The test Vm friendly name. + :vartype test_vm_friendly_name: str + :ivar network_connection_status: The network connection status. + :vartype network_connection_status: str + :ivar network_friendly_name: The network friendly name. + :vartype network_friendly_name: str + :ivar subnet: The network subnet. + :vartype subnet: str + :ivar recovery_point_id: The recovery point Id. + :vartype recovery_point_id: str + :ivar recovery_point_time: The recovery point time. + :vartype recovery_point_time: ~datetime.datetime + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "test_vm_name": {"key": "testVmName", "type": "str"}, + "test_vm_friendly_name": {"key": "testVmFriendlyName", "type": "str"}, + "network_connection_status": {"key": "networkConnectionStatus", "type": "str"}, + "network_friendly_name": {"key": "networkFriendlyName", "type": "str"}, + "subnet": {"key": "subnet", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, } def __init__( @@ -6254,7 +7758,27 @@ def __init__( recovery_point_time: Optional[datetime.datetime] = None, **kwargs ): - super(FailoverReplicationProtectedItemDetails, self).__init__(**kwargs) + """ + :keyword name: The name. + :paramtype name: str + :keyword friendly_name: The friendly name. + :paramtype friendly_name: str + :keyword test_vm_name: The test Vm name. + :paramtype test_vm_name: str + :keyword test_vm_friendly_name: The test Vm friendly name. + :paramtype test_vm_friendly_name: str + :keyword network_connection_status: The network connection status. + :paramtype network_connection_status: str + :keyword network_friendly_name: The network friendly name. + :paramtype network_friendly_name: str + :keyword subnet: The network subnet. + :paramtype subnet: str + :keyword recovery_point_id: The recovery point Id. + :paramtype recovery_point_id: str + :keyword recovery_point_time: The recovery point time. + :paramtype recovery_point_time: ~datetime.datetime + """ + super().__init__(**kwargs) self.name = name self.friendly_name = friendly_name self.test_vm_name = test_vm_name @@ -6266,108 +7790,110 @@ def __init__( self.recovery_point_time = recovery_point_time -class GroupTaskDetails(msrest.serialization.Model): +class GroupTaskDetails(_serialization.Model): """This class represents the group task details when parent child relationship exists in the drill down. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: InlineWorkflowTaskDetails, RecoveryPlanGroupTaskDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InlineWorkflowTaskDetails, RecoveryPlanGroupTaskDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param child_tasks: The child tasks. - :type child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar child_tasks: The child tasks. + :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'child_tasks': {'key': 'childTasks', 'type': '[ASRTask]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "child_tasks": {"key": "childTasks", "type": "[ASRTask]"}, } _subtype_map = { - 'instance_type': {'InlineWorkflowTaskDetails': 'InlineWorkflowTaskDetails', 'RecoveryPlanGroupTaskDetails': 'RecoveryPlanGroupTaskDetails'} - } - - def __init__( - self, - *, - child_tasks: Optional[List["ASRTask"]] = None, - **kwargs - ): - super(GroupTaskDetails, self).__init__(**kwargs) + "instance_type": { + "InlineWorkflowTaskDetails": "InlineWorkflowTaskDetails", + "RecoveryPlanGroupTaskDetails": "RecoveryPlanGroupTaskDetails", + } + } + + def __init__(self, *, child_tasks: Optional[List["_models.ASRTask"]] = None, **kwargs): + """ + :keyword child_tasks: The child tasks. + :paramtype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] self.child_tasks = child_tasks -class HealthError(msrest.serialization.Model): +class HealthError(_serialization.Model): # pylint: disable=too-many-instance-attributes """Health Error. - :param inner_health_errors: The inner health errors. HealthError having a list of HealthError - as child errors is problematic. InnerHealthError is used because this will prevent an infinite + :ivar inner_health_errors: The inner health errors. HealthError having a list of HealthError as + child errors is problematic. InnerHealthError is used because this will prevent an infinite loop of structures when Hydra tries to auto-generate the contract. We are exposing the related health errors as inner health errors and all API consumers can utilize this in the same fashion as Exception -> InnerException. - :type inner_health_errors: + :vartype inner_health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.InnerHealthError] - :param error_source: Source of error. - :type error_source: str - :param error_type: Type of error. - :type error_type: str - :param error_level: Level of error. - :type error_level: str - :param error_category: Category of error. - :type error_category: str - :param error_code: Error code. - :type error_code: str - :param summary_message: Summary message of the entity. - :type summary_message: str - :param error_message: Error message. - :type error_message: str - :param possible_causes: Possible causes of error. - :type possible_causes: str - :param recommended_action: Recommended action to resolve error. - :type recommended_action: str - :param creation_time_utc: Error creation time (UTC). - :type creation_time_utc: ~datetime.datetime - :param recovery_provider_error_message: DRA error message. - :type recovery_provider_error_message: str - :param entity_id: ID of the entity. - :type entity_id: str - :param error_id: The health error unique id. - :type error_id: str - :param customer_resolvability: Value indicating whether the health error is customer - resolvable. Possible values include: "Allowed", "NotAllowed". - :type customer_resolvability: str or + :ivar error_source: Source of error. + :vartype error_source: str + :ivar error_type: Type of error. + :vartype error_type: str + :ivar error_level: Level of error. + :vartype error_level: str + :ivar error_category: Category of error. + :vartype error_category: str + :ivar error_code: Error code. + :vartype error_code: str + :ivar summary_message: Summary message of the entity. + :vartype summary_message: str + :ivar error_message: Error message. + :vartype error_message: str + :ivar possible_causes: Possible causes of error. + :vartype possible_causes: str + :ivar recommended_action: Recommended action to resolve error. + :vartype recommended_action: str + :ivar creation_time_utc: Error creation time (UTC). + :vartype creation_time_utc: ~datetime.datetime + :ivar recovery_provider_error_message: DRA error message. + :vartype recovery_provider_error_message: str + :ivar entity_id: ID of the entity. + :vartype entity_id: str + :ivar error_id: The health error unique id. + :vartype error_id: str + :ivar customer_resolvability: Value indicating whether the health error is customer resolvable. + Known values are: "Allowed" and "NotAllowed". + :vartype customer_resolvability: str or ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability """ _attribute_map = { - 'inner_health_errors': {'key': 'innerHealthErrors', 'type': '[InnerHealthError]'}, - 'error_source': {'key': 'errorSource', 'type': 'str'}, - 'error_type': {'key': 'errorType', 'type': 'str'}, - 'error_level': {'key': 'errorLevel', 'type': 'str'}, - 'error_category': {'key': 'errorCategory', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'summary_message': {'key': 'summaryMessage', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'creation_time_utc': {'key': 'creationTimeUtc', 'type': 'iso-8601'}, - 'recovery_provider_error_message': {'key': 'recoveryProviderErrorMessage', 'type': 'str'}, - 'entity_id': {'key': 'entityId', 'type': 'str'}, - 'error_id': {'key': 'errorId', 'type': 'str'}, - 'customer_resolvability': {'key': 'customerResolvability', 'type': 'str'}, + "inner_health_errors": {"key": "innerHealthErrors", "type": "[InnerHealthError]"}, + "error_source": {"key": "errorSource", "type": "str"}, + "error_type": {"key": "errorType", "type": "str"}, + "error_level": {"key": "errorLevel", "type": "str"}, + "error_category": {"key": "errorCategory", "type": "str"}, + "error_code": {"key": "errorCode", "type": "str"}, + "summary_message": {"key": "summaryMessage", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "creation_time_utc": {"key": "creationTimeUtc", "type": "iso-8601"}, + "recovery_provider_error_message": {"key": "recoveryProviderErrorMessage", "type": "str"}, + "entity_id": {"key": "entityId", "type": "str"}, + "error_id": {"key": "errorId", "type": "str"}, + "customer_resolvability": {"key": "customerResolvability", "type": "str"}, } def __init__( self, *, - inner_health_errors: Optional[List["InnerHealthError"]] = None, + inner_health_errors: Optional[List["_models.InnerHealthError"]] = None, error_source: Optional[str] = None, error_type: Optional[str] = None, error_level: Optional[str] = None, @@ -6381,10 +7907,49 @@ def __init__( recovery_provider_error_message: Optional[str] = None, entity_id: Optional[str] = None, error_id: Optional[str] = None, - customer_resolvability: Optional[Union[str, "HealthErrorCustomerResolvability"]] = None, - **kwargs - ): - super(HealthError, self).__init__(**kwargs) + customer_resolvability: Optional[Union[str, "_models.HealthErrorCustomerResolvability"]] = None, + **kwargs + ): + """ + :keyword inner_health_errors: The inner health errors. HealthError having a list of HealthError + as child errors is problematic. InnerHealthError is used because this will prevent an infinite + loop of structures when Hydra tries to auto-generate the contract. We are exposing the related + health errors as inner health errors and all API consumers can utilize this in the same fashion + as Exception -> InnerException. + :paramtype inner_health_errors: + list[~azure.mgmt.recoveryservicessiterecovery.models.InnerHealthError] + :keyword error_source: Source of error. + :paramtype error_source: str + :keyword error_type: Type of error. + :paramtype error_type: str + :keyword error_level: Level of error. + :paramtype error_level: str + :keyword error_category: Category of error. + :paramtype error_category: str + :keyword error_code: Error code. + :paramtype error_code: str + :keyword summary_message: Summary message of the entity. + :paramtype summary_message: str + :keyword error_message: Error message. + :paramtype error_message: str + :keyword possible_causes: Possible causes of error. + :paramtype possible_causes: str + :keyword recommended_action: Recommended action to resolve error. + :paramtype recommended_action: str + :keyword creation_time_utc: Error creation time (UTC). + :paramtype creation_time_utc: ~datetime.datetime + :keyword recovery_provider_error_message: DRA error message. + :paramtype recovery_provider_error_message: str + :keyword entity_id: ID of the entity. + :paramtype entity_id: str + :keyword error_id: The health error unique id. + :paramtype error_id: str + :keyword customer_resolvability: Value indicating whether the health error is customer + resolvable. Known values are: "Allowed" and "NotAllowed". + :paramtype customer_resolvability: str or + ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability + """ + super().__init__(**kwargs) self.inner_health_errors = inner_health_errors self.error_source = error_source self.error_type = error_type @@ -6402,55 +7967,76 @@ def __init__( self.customer_resolvability = customer_resolvability -class HealthErrorSummary(msrest.serialization.Model): +class HealthErrorSummary(_serialization.Model): """class to define the summary of the health error details. - :param summary_code: The code of the health error. - :type summary_code: str - :param category: The category of the health error. Possible values include: "None", - "Replication", "TestFailover", "Configuration", "FabricInfrastructure", "VersionExpiry", + :ivar summary_code: The code of the health error. + :vartype summary_code: str + :ivar category: The category of the health error. Known values are: "None", "Replication", + "TestFailover", "Configuration", "FabricInfrastructure", "VersionExpiry", "AgentAutoUpdateInfra", "AgentAutoUpdateArtifactDeleted", "AgentAutoUpdateRunAsAccount", - "AgentAutoUpdateRunAsAccountExpiry", "AgentAutoUpdateRunAsAccountExpired". - :type category: str or ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCategory - :param severity: Severity of error. Possible values include: "NONE", "Warning", "Error", - "Info". - :type severity: str or ~azure.mgmt.recoveryservicessiterecovery.models.Severity - :param summary_message: The summary message of the health error. - :type summary_message: str - :param affected_resource_type: The type of affected ARM resource. - :type affected_resource_type: str - :param affected_resource_subtype: The sub type of any subcomponent within the ARM resource that + "AgentAutoUpdateRunAsAccountExpiry", and "AgentAutoUpdateRunAsAccountExpired". + :vartype category: str or ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCategory + :ivar severity: Severity of error. Known values are: "NONE", "Warning", "Error", and "Info". + :vartype severity: str or ~azure.mgmt.recoveryservicessiterecovery.models.Severity + :ivar summary_message: The summary message of the health error. + :vartype summary_message: str + :ivar affected_resource_type: The type of affected ARM resource. + :vartype affected_resource_type: str + :ivar affected_resource_subtype: The sub type of any subcomponent within the ARM resource that this might be applicable. Value remains null if not applicable. - :type affected_resource_subtype: str - :param affected_resource_correlation_ids: The list of affected resource correlation Ids. This + :vartype affected_resource_subtype: str + :ivar affected_resource_correlation_ids: The list of affected resource correlation Ids. This can be used to uniquely identify the count of items affected by a specific category and severity as well as count of item affected by an specific issue. - :type affected_resource_correlation_ids: list[str] + :vartype affected_resource_correlation_ids: list[str] """ _attribute_map = { - 'summary_code': {'key': 'summaryCode', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'severity': {'key': 'severity', 'type': 'str'}, - 'summary_message': {'key': 'summaryMessage', 'type': 'str'}, - 'affected_resource_type': {'key': 'affectedResourceType', 'type': 'str'}, - 'affected_resource_subtype': {'key': 'affectedResourceSubtype', 'type': 'str'}, - 'affected_resource_correlation_ids': {'key': 'affectedResourceCorrelationIds', 'type': '[str]'}, + "summary_code": {"key": "summaryCode", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "summary_message": {"key": "summaryMessage", "type": "str"}, + "affected_resource_type": {"key": "affectedResourceType", "type": "str"}, + "affected_resource_subtype": {"key": "affectedResourceSubtype", "type": "str"}, + "affected_resource_correlation_ids": {"key": "affectedResourceCorrelationIds", "type": "[str]"}, } def __init__( self, *, summary_code: Optional[str] = None, - category: Optional[Union[str, "HealthErrorCategory"]] = None, - severity: Optional[Union[str, "Severity"]] = None, + category: Optional[Union[str, "_models.HealthErrorCategory"]] = None, + severity: Optional[Union[str, "_models.Severity"]] = None, summary_message: Optional[str] = None, affected_resource_type: Optional[str] = None, affected_resource_subtype: Optional[str] = None, affected_resource_correlation_ids: Optional[List[str]] = None, **kwargs ): - super(HealthErrorSummary, self).__init__(**kwargs) + """ + :keyword summary_code: The code of the health error. + :paramtype summary_code: str + :keyword category: The category of the health error. Known values are: "None", "Replication", + "TestFailover", "Configuration", "FabricInfrastructure", "VersionExpiry", + "AgentAutoUpdateInfra", "AgentAutoUpdateArtifactDeleted", "AgentAutoUpdateRunAsAccount", + "AgentAutoUpdateRunAsAccountExpiry", and "AgentAutoUpdateRunAsAccountExpired". + :paramtype category: str or ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCategory + :keyword severity: Severity of error. Known values are: "NONE", "Warning", "Error", and "Info". + :paramtype severity: str or ~azure.mgmt.recoveryservicessiterecovery.models.Severity + :keyword summary_message: The summary message of the health error. + :paramtype summary_message: str + :keyword affected_resource_type: The type of affected ARM resource. + :paramtype affected_resource_type: str + :keyword affected_resource_subtype: The sub type of any subcomponent within the ARM resource + that this might be applicable. Value remains null if not applicable. + :paramtype affected_resource_subtype: str + :keyword affected_resource_correlation_ids: The list of affected resource correlation Ids. This + can be used to uniquely identify the count of items affected by a specific category and + severity as well as count of item affected by an specific issue. + :paramtype affected_resource_correlation_ids: list[str] + """ + super().__init__(**kwargs) self.summary_code = summary_code self.category = category self.severity = severity @@ -6460,7 +8046,7 @@ def __init__( self.affected_resource_correlation_ids = affected_resource_correlation_ids -class HyperVHostDetails(msrest.serialization.Model): +class HyperVHostDetails(_serialization.Model): """Hyper-V host details. Variables are only populated by the server, and will be ignored when sending a request. @@ -6474,22 +8060,20 @@ class HyperVHostDetails(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'mars_agent_version': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "mars_agent_version": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'mars_agent_version': {'key': 'marsAgentVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "mars_agent_version": {"key": "marsAgentVersion", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(HyperVHostDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.mars_agent_version = None @@ -6500,29 +8084,28 @@ class HyperVReplica2012EventDetails(EventProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param container_name: The container friendly name. - :type container_name: str - :param fabric_name: The fabric friendly name. - :type fabric_name: str - :param remote_container_name: The remote container name. - :type remote_container_name: str - :param remote_fabric_name: The remote fabric name. - :type remote_fabric_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar container_name: The container friendly name. + :vartype container_name: str + :ivar fabric_name: The fabric friendly name. + :vartype fabric_name: str + :ivar remote_container_name: The remote container name. + :vartype remote_container_name: str + :ivar remote_fabric_name: The remote fabric name. + :vartype remote_fabric_name: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'remote_container_name': {'key': 'remoteContainerName', 'type': 'str'}, - 'remote_fabric_name': {'key': 'remoteFabricName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "remote_container_name": {"key": "remoteContainerName", "type": "str"}, + "remote_fabric_name": {"key": "remoteFabricName", "type": "str"}, } def __init__( @@ -6534,8 +8117,18 @@ def __init__( remote_fabric_name: Optional[str] = None, **kwargs ): - super(HyperVReplica2012EventDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012' # type: str + """ + :keyword container_name: The container friendly name. + :paramtype container_name: str + :keyword fabric_name: The fabric friendly name. + :paramtype fabric_name: str + :keyword remote_container_name: The remote container name. + :paramtype remote_container_name: str + :keyword remote_fabric_name: The remote fabric name. + :paramtype remote_fabric_name: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplica2012" # type: str self.container_name = container_name self.fabric_name = fabric_name self.remote_container_name = remote_container_name @@ -6547,29 +8140,28 @@ class HyperVReplica2012R2EventDetails(EventProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param container_name: The container friendly name. - :type container_name: str - :param fabric_name: The fabric friendly name. - :type fabric_name: str - :param remote_container_name: The remote container name. - :type remote_container_name: str - :param remote_fabric_name: The remote fabric name. - :type remote_fabric_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar container_name: The container friendly name. + :vartype container_name: str + :ivar fabric_name: The fabric friendly name. + :vartype fabric_name: str + :ivar remote_container_name: The remote container name. + :vartype remote_container_name: str + :ivar remote_fabric_name: The remote fabric name. + :vartype remote_fabric_name: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'remote_container_name': {'key': 'remoteContainerName', 'type': 'str'}, - 'remote_fabric_name': {'key': 'remoteFabricName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "remote_container_name": {"key": "remoteContainerName", "type": "str"}, + "remote_fabric_name": {"key": "remoteFabricName", "type": "str"}, } def __init__( @@ -6581,8 +8173,18 @@ def __init__( remote_fabric_name: Optional[str] = None, **kwargs ): - super(HyperVReplica2012R2EventDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012R2' # type: str + """ + :keyword container_name: The container friendly name. + :paramtype container_name: str + :keyword fabric_name: The fabric friendly name. + :paramtype fabric_name: str + :keyword remote_container_name: The remote container name. + :paramtype remote_container_name: str + :keyword remote_fabric_name: The remote fabric name. + :paramtype remote_fabric_name: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplica2012R2" # type: str self.container_name = container_name self.fabric_name = fabric_name self.remote_container_name = remote_container_name @@ -6594,22 +8196,22 @@ class HyperVReplicaAzureApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecif All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: The primary kek certificate pfx. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: The secondary kek certificate pfx. - :type secondary_kek_certificate_pfx: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar primary_kek_certificate_pfx: The primary kek certificate pfx. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: The secondary kek certificate pfx. + :vartype secondary_kek_certificate_pfx: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, + "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, } def __init__( @@ -6619,31 +8221,37 @@ def __init__( secondary_kek_certificate_pfx: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzureApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + """ + :keyword primary_kek_certificate_pfx: The primary kek certificate pfx. + :paramtype primary_kek_certificate_pfx: str + :keyword secondary_kek_certificate_pfx: The secondary kek certificate pfx. + :paramtype secondary_kek_certificate_pfx: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.primary_kek_certificate_pfx = primary_kek_certificate_pfx self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx -class HyperVReplicaAzureDiskInputDetails(msrest.serialization.Model): +class HyperVReplicaAzureDiskInputDetails(_serialization.Model): """Disk input details. - :param disk_id: The DiskId. - :type disk_id: str - :param log_storage_account_id: The LogStorageAccountId. - :type log_storage_account_id: str - :param disk_type: The DiskType. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar disk_id: The DiskId. + :vartype disk_id: str + :ivar log_storage_account_id: The LogStorageAccountId. + :vartype log_storage_account_id: str + :ivar disk_type: The DiskType. Known values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :type disk_encryption_set_id: str + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :vartype disk_encryption_set_id: str """ _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, } def __init__( @@ -6651,130 +8259,146 @@ def __init__( *, disk_id: Optional[str] = None, log_storage_account_id: Optional[str] = None, - disk_type: Optional[Union[str, "DiskAccountType"]] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, disk_encryption_set_id: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzureDiskInputDetails, self).__init__(**kwargs) + """ + :keyword disk_id: The DiskId. + :paramtype disk_id: str + :keyword log_storage_account_id: The LogStorageAccountId. + :paramtype log_storage_account_id: str + :keyword disk_type: The DiskType. Known values are: "Standard_LRS", "Premium_LRS", and + "StandardSSD_LRS". + :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :keyword disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :paramtype disk_encryption_set_id: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.log_storage_account_id = log_storage_account_id self.disk_type = disk_type self.disk_encryption_set_id = disk_encryption_set_id -class HyperVReplicaAzureEnableProtectionInput(EnableProtectionProviderSpecificInput): +class HyperVReplicaAzureEnableProtectionInput( + EnableProtectionProviderSpecificInput +): # pylint: disable=too-many-instance-attributes """HyperVReplicaAzure specific enable protection input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param hv_host_vm_id: The Hyper-V host VM Id. - :type hv_host_vm_id: str - :param vm_name: The VM Name. - :type vm_name: str - :param os_type: The OS type associated with VM. - :type os_type: str - :param vhd_id: The OS disk VHD id associated with VM. - :type vhd_id: str - :param target_storage_account_id: The storage account Id. - :type target_storage_account_id: str - :param target_azure_network_id: The selected target Azure network Id. - :type target_azure_network_id: str - :param target_azure_subnet_id: The selected target Azure subnet Id. - :type target_azure_subnet_id: str - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar hv_host_vm_id: The Hyper-V host VM Id. + :vartype hv_host_vm_id: str + :ivar vm_name: The VM Name. + :vartype vm_name: str + :ivar os_type: The OS type associated with VM. + :vartype os_type: str + :ivar vhd_id: The OS disk VHD id associated with VM. + :vartype vhd_id: str + :ivar target_storage_account_id: The storage account Id. + :vartype target_storage_account_id: str + :ivar target_azure_network_id: The selected target Azure network Id. + :vartype target_azure_network_id: str + :ivar target_azure_subnet_id: The selected target Azure subnet Id. + :vartype target_azure_subnet_id: str + :ivar enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param target_azure_vm_name: The target azure VM Name. - :type target_azure_vm_name: str - :param log_storage_account_id: The storage account to be used for logging during replication. - :type log_storage_account_id: str - :param disks_to_include: The list of VHD Ids of disks to be protected. - :type disks_to_include: list[str] - :param target_azure_v1_resource_group_id: The Id of the target resource group (for classic + :vartype enable_rdp_on_target_option: str + :ivar target_azure_vm_name: The target azure VM Name. + :vartype target_azure_vm_name: str + :ivar log_storage_account_id: The storage account to be used for logging during replication. + :vartype log_storage_account_id: str + :ivar disks_to_include: The list of VHD Ids of disks to be protected. + :vartype disks_to_include: list[str] + :ivar target_azure_v1_resource_group_id: The Id of the target resource group (for classic deployment) in which the failover VM is to be created. - :type target_azure_v1_resource_group_id: str - :param target_azure_v2_resource_group_id: The Id of the target resource group (for resource + :vartype target_azure_v1_resource_group_id: str + :ivar target_azure_v2_resource_group_id: The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created. - :type target_azure_v2_resource_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during + :vartype target_azure_v2_resource_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during failover. - :type use_managed_disks: str - :param target_availability_set_id: The target availability set ARM Id for resource manager + :vartype use_managed_disks: str + :ivar target_availability_set_id: The target availability set ARM Id for resource manager deployment. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param license_type: License type. Possible values include: "NotSpecified", "NoLicenseType", + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_proximity_placement_group_id: The proximity placement group ARM Id. - :type target_proximity_placement_group_id: str - :param use_managed_disks_for_replication: A value indicating whether managed disks should be + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_proximity_placement_group_id: The proximity placement group ARM Id. + :vartype target_proximity_placement_group_id: str + :ivar use_managed_disks_for_replication: A value indicating whether managed disks should be used during replication. - :type use_managed_disks_for_replication: str - :param disk_type: The DiskType. Possible values include: "Standard_LRS", "Premium_LRS", + :vartype use_managed_disks_for_replication: str + :ivar disk_type: The DiskType. Known values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disks_to_include_for_managed_disks: The disks to include list for managed disks. - :type disks_to_include_for_managed_disks: + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disks_to_include_for_managed_disks: The disks to include list for managed disks. + :vartype disks_to_include_for_managed_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureDiskInputDetails] - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_managed_disk_tags: The tags for the seed managed disks. - :type seed_managed_disk_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'hv_host_vm_id': {'key': 'hvHostVmId', 'type': 'str'}, - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vhd_id': {'key': 'vhdId', 'type': 'str'}, - 'target_storage_account_id': {'key': 'targetStorageAccountId', 'type': 'str'}, - 'target_azure_network_id': {'key': 'targetAzureNetworkId', 'type': 'str'}, - 'target_azure_subnet_id': {'key': 'targetAzureSubnetId', 'type': 'str'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'target_azure_vm_name': {'key': 'targetAzureVmName', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[str]'}, - 'target_azure_v1_resource_group_id': {'key': 'targetAzureV1ResourceGroupId', 'type': 'str'}, - 'target_azure_v2_resource_group_id': {'key': 'targetAzureV2ResourceGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'use_managed_disks_for_replication': {'key': 'useManagedDisksForReplication', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disks_to_include_for_managed_disks': {'key': 'disksToIncludeForManagedDisks', 'type': '[HyperVReplicaAzureDiskInputDetails]'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_managed_disk_tags': {'key': 'seedManagedDiskTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - } - - def __init__( + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "hv_host_vm_id": {"key": "hvHostVmId", "type": "str"}, + "vm_name": {"key": "vmName", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "vhd_id": {"key": "vhdId", "type": "str"}, + "target_storage_account_id": {"key": "targetStorageAccountId", "type": "str"}, + "target_azure_network_id": {"key": "targetAzureNetworkId", "type": "str"}, + "target_azure_subnet_id": {"key": "targetAzureSubnetId", "type": "str"}, + "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, + "target_azure_vm_name": {"key": "targetAzureVmName", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "disks_to_include": {"key": "disksToInclude", "type": "[str]"}, + "target_azure_v1_resource_group_id": {"key": "targetAzureV1ResourceGroupId", "type": "str"}, + "target_azure_v2_resource_group_id": {"key": "targetAzureV2ResourceGroupId", "type": "str"}, + "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, + "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, + "target_vm_size": {"key": "targetVmSize", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "use_managed_disks_for_replication": {"key": "useManagedDisksForReplication", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "disks_to_include_for_managed_disks": { + "key": "disksToIncludeForManagedDisks", + "type": "[HyperVReplicaAzureDiskInputDetails]", + }, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, + "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, + "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "{str}"}, + "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, + "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, hv_host_vm_id: Optional[str] = None, @@ -6793,13 +8417,13 @@ def __init__( use_managed_disks: Optional[str] = None, target_availability_set_id: Optional[str] = None, target_availability_zone: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, - sql_server_license_type: Optional[Union[str, "SqlServerLicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, target_vm_size: Optional[str] = None, target_proximity_placement_group_id: Optional[str] = None, use_managed_disks_for_replication: Optional[str] = None, - disk_type: Optional[Union[str, "DiskAccountType"]] = None, - disks_to_include_for_managed_disks: Optional[List["HyperVReplicaAzureDiskInputDetails"]] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + disks_to_include_for_managed_disks: Optional[List["_models.HyperVReplicaAzureDiskInputDetails"]] = None, disk_encryption_set_id: Optional[str] = None, target_vm_tags: Optional[Dict[str, str]] = None, seed_managed_disk_tags: Optional[Dict[str, str]] = None, @@ -6807,8 +8431,77 @@ def __init__( target_nic_tags: Optional[Dict[str, str]] = None, **kwargs ): - super(HyperVReplicaAzureEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + """ + :keyword hv_host_vm_id: The Hyper-V host VM Id. + :paramtype hv_host_vm_id: str + :keyword vm_name: The VM Name. + :paramtype vm_name: str + :keyword os_type: The OS type associated with VM. + :paramtype os_type: str + :keyword vhd_id: The OS disk VHD id associated with VM. + :paramtype vhd_id: str + :keyword target_storage_account_id: The storage account Id. + :paramtype target_storage_account_id: str + :keyword target_azure_network_id: The selected target Azure network Id. + :paramtype target_azure_network_id: str + :keyword target_azure_subnet_id: The selected target Azure subnet Id. + :paramtype target_azure_subnet_id: str + :keyword enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :paramtype enable_rdp_on_target_option: str + :keyword target_azure_vm_name: The target azure VM Name. + :paramtype target_azure_vm_name: str + :keyword log_storage_account_id: The storage account to be used for logging during replication. + :paramtype log_storage_account_id: str + :keyword disks_to_include: The list of VHD Ids of disks to be protected. + :paramtype disks_to_include: list[str] + :keyword target_azure_v1_resource_group_id: The Id of the target resource group (for classic + deployment) in which the failover VM is to be created. + :paramtype target_azure_v1_resource_group_id: str + :keyword target_azure_v2_resource_group_id: The Id of the target resource group (for resource + manager deployment) in which the failover VM is to be created. + :paramtype target_azure_v2_resource_group_id: str + :keyword use_managed_disks: A value indicating whether managed disks should be used during + failover. + :paramtype use_managed_disks: str + :keyword target_availability_set_id: The target availability set ARM Id for resource manager + deployment. + :paramtype target_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :keyword sql_server_license_type: The SQL Server license type. Known values are: + "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". + :paramtype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :keyword target_vm_size: The target VM size. + :paramtype target_vm_size: str + :keyword target_proximity_placement_group_id: The proximity placement group ARM Id. + :paramtype target_proximity_placement_group_id: str + :keyword use_managed_disks_for_replication: A value indicating whether managed disks should be + used during replication. + :paramtype use_managed_disks_for_replication: str + :keyword disk_type: The DiskType. Known values are: "Standard_LRS", "Premium_LRS", and + "StandardSSD_LRS". + :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :keyword disks_to_include_for_managed_disks: The disks to include list for managed disks. + :paramtype disks_to_include_for_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureDiskInputDetails] + :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :paramtype disk_encryption_set_id: str + :keyword target_vm_tags: The target VM tags. + :paramtype target_vm_tags: dict[str, str] + :keyword seed_managed_disk_tags: The tags for the seed managed disks. + :paramtype seed_managed_disk_tags: dict[str, str] + :keyword target_managed_disk_tags: The tags for the target managed disks. + :paramtype target_managed_disk_tags: dict[str, str] + :keyword target_nic_tags: The tags for the target NICs. + :paramtype target_nic_tags: dict[str, str] + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.hv_host_vm_id = hv_host_vm_id self.vm_name = vm_name self.os_type = os_type @@ -6844,26 +8537,25 @@ class HyperVReplicaAzureEventDetails(EventProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param container_name: The container friendly name. - :type container_name: str - :param fabric_name: The fabric friendly name. - :type fabric_name: str - :param remote_container_name: The remote container name. - :type remote_container_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar container_name: The container friendly name. + :vartype container_name: str + :ivar fabric_name: The fabric friendly name. + :vartype fabric_name: str + :ivar remote_container_name: The remote container name. + :vartype remote_container_name: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'remote_container_name': {'key': 'remoteContainerName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "remote_container_name": {"key": "remoteContainerName", "type": "str"}, } def __init__( @@ -6874,42 +8566,53 @@ def __init__( remote_container_name: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzureEventDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + """ + :keyword container_name: The container friendly name. + :paramtype container_name: str + :keyword fabric_name: The fabric friendly name. + :paramtype fabric_name: str + :keyword remote_container_name: The remote container name. + :paramtype remote_container_name: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.container_name = container_name self.fabric_name = fabric_name self.remote_container_name = remote_container_name -class PlannedFailoverProviderSpecificFailoverInput(msrest.serialization.Model): +class PlannedFailoverProviderSpecificFailoverInput(_serialization.Model): """Provider specific failover input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: HyperVReplicaAzurePlannedFailoverProviderInput, HyperVReplicaAzureFailbackProviderInput, InMageRcmFailbackPlannedFailoverProviderInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVReplicaAzurePlannedFailoverProviderInput, HyperVReplicaAzureFailbackProviderInput, + InMageRcmFailbackPlannedFailoverProviderInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'HyperVReplicaAzure': 'HyperVReplicaAzurePlannedFailoverProviderInput', 'HyperVReplicaAzureFailback': 'HyperVReplicaAzureFailbackProviderInput', 'InMageRcmFailback': 'InMageRcmFailbackPlannedFailoverProviderInput'} + "instance_type": { + "HyperVReplicaAzure": "HyperVReplicaAzurePlannedFailoverProviderInput", + "HyperVReplicaAzureFailback": "HyperVReplicaAzureFailbackProviderInput", + "InMageRcmFailback": "InMageRcmFailbackPlannedFailoverProviderInput", + } } - def __init__( - self, - **kwargs - ): - super(PlannedFailoverProviderSpecificFailoverInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -6918,25 +8621,25 @@ class HyperVReplicaAzureFailbackProviderInput(PlannedFailoverProviderSpecificFai All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param data_sync_option: Data sync option. - :type data_sync_option: str - :param recovery_vm_creation_option: ALR options to create alternate recovery. - :type recovery_vm_creation_option: str - :param provider_id_for_alternate_recovery: Provider Id for alternate location. - :type provider_id_for_alternate_recovery: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar data_sync_option: Data sync option. + :vartype data_sync_option: str + :ivar recovery_vm_creation_option: ALR options to create alternate recovery. + :vartype recovery_vm_creation_option: str + :ivar provider_id_for_alternate_recovery: Provider Id for alternate location. + :vartype provider_id_for_alternate_recovery: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'data_sync_option': {'key': 'dataSyncOption', 'type': 'str'}, - 'recovery_vm_creation_option': {'key': 'recoveryVmCreationOption', 'type': 'str'}, - 'provider_id_for_alternate_recovery': {'key': 'providerIdForAlternateRecovery', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "data_sync_option": {"key": "dataSyncOption", "type": "str"}, + "recovery_vm_creation_option": {"key": "recoveryVmCreationOption", "type": "str"}, + "provider_id_for_alternate_recovery": {"key": "providerIdForAlternateRecovery", "type": "str"}, } def __init__( @@ -6947,31 +8650,39 @@ def __init__( provider_id_for_alternate_recovery: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzureFailbackProviderInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzureFailback' # type: str + """ + :keyword data_sync_option: Data sync option. + :paramtype data_sync_option: str + :keyword recovery_vm_creation_option: ALR options to create alternate recovery. + :paramtype recovery_vm_creation_option: str + :keyword provider_id_for_alternate_recovery: Provider Id for alternate location. + :paramtype provider_id_for_alternate_recovery: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzureFailback" # type: str self.data_sync_option = data_sync_option self.recovery_vm_creation_option = recovery_vm_creation_option self.provider_id_for_alternate_recovery = provider_id_for_alternate_recovery -class HyperVReplicaAzureManagedDiskDetails(msrest.serialization.Model): +class HyperVReplicaAzureManagedDiskDetails(_serialization.Model): """Hyper-V Managed disk details. - :param disk_id: The disk Id. - :type disk_id: str - :param seed_managed_disk_id: Seed managed disk Id. - :type seed_managed_disk_id: str - :param replica_disk_type: The replica disk type. - :type replica_disk_type: str - :param disk_encryption_set_id: The disk encryption set ARM Id. - :type disk_encryption_set_id: str + :ivar disk_id: The disk Id. + :vartype disk_id: str + :ivar seed_managed_disk_id: Seed managed disk Id. + :vartype seed_managed_disk_id: str + :ivar replica_disk_type: The replica disk type. + :vartype replica_disk_type: str + :ivar disk_encryption_set_id: The disk encryption set ARM Id. + :vartype disk_encryption_set_id: str """ _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'seed_managed_disk_id': {'key': 'seedManagedDiskId', 'type': 'str'}, - 'replica_disk_type': {'key': 'replicaDiskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "seed_managed_disk_id": {"key": "seedManagedDiskId", "type": "str"}, + "replica_disk_type": {"key": "replicaDiskType", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, } def __init__( @@ -6983,7 +8694,17 @@ def __init__( disk_encryption_set_id: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzureManagedDiskDetails, self).__init__(**kwargs) + """ + :keyword disk_id: The disk Id. + :paramtype disk_id: str + :keyword seed_managed_disk_id: Seed managed disk Id. + :paramtype seed_managed_disk_id: str + :keyword replica_disk_type: The replica disk type. + :paramtype replica_disk_type: str + :keyword disk_encryption_set_id: The disk encryption set ARM Id. + :paramtype disk_encryption_set_id: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.seed_managed_disk_id = seed_managed_disk_id self.replica_disk_type = replica_disk_type @@ -6995,26 +8716,26 @@ class HyperVReplicaAzurePlannedFailoverProviderInput(PlannedFailoverProviderSpec All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: Primary kek certificate pfx. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :type secondary_kek_certificate_pfx: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar primary_kek_certificate_pfx: Primary kek certificate pfx. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: Secondary kek certificate pfx. + :vartype secondary_kek_certificate_pfx: str + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, + "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } def __init__( @@ -7025,8 +8746,17 @@ def __init__( recovery_point_id: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzurePlannedFailoverProviderInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + """ + :keyword primary_kek_certificate_pfx: Primary kek certificate pfx. + :paramtype primary_kek_certificate_pfx: str + :keyword secondary_kek_certificate_pfx: Secondary kek certificate pfx. + :paramtype secondary_kek_certificate_pfx: str + :keyword recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.primary_kek_certificate_pfx = primary_kek_certificate_pfx self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx self.recovery_point_id = recovery_point_id @@ -7037,39 +8767,41 @@ class HyperVReplicaAzurePolicyDetails(PolicyProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_history_duration_in_hours: The duration (in hours) to which point the + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar recovery_point_history_duration_in_hours: The duration (in hours) to which point the recovery history needs to be maintained. - :type recovery_point_history_duration_in_hours: int - :param application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which + :vartype recovery_point_history_duration_in_hours: int + :ivar application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM. - :type application_consistent_snapshot_frequency_in_hours: int - :param replication_interval: The replication interval. - :type replication_interval: int - :param online_replication_start_time: The scheduled start time for the initial replication. If + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar replication_interval: The replication interval. + :vartype replication_interval: int + :ivar online_replication_start_time: The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately. - :type online_replication_start_time: str - :param encryption: A value indicating whether encryption is enabled for virtual machines in - this cloud. - :type encryption: str - :param active_storage_account_id: The active storage account Id. - :type active_storage_account_id: str + :vartype online_replication_start_time: str + :ivar encryption: A value indicating whether encryption is enabled for virtual machines in this + cloud. + :vartype encryption: str + :ivar active_storage_account_id: The active storage account Id. + :vartype active_storage_account_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_duration_in_hours': {'key': 'recoveryPointHistoryDurationInHours', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'replication_interval': {'key': 'replicationInterval', 'type': 'int'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'encryption': {'key': 'encryption', 'type': 'str'}, - 'active_storage_account_id': {'key': 'activeStorageAccountId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_history_duration_in_hours": {"key": "recoveryPointHistoryDurationInHours", "type": "int"}, + "application_consistent_snapshot_frequency_in_hours": { + "key": "applicationConsistentSnapshotFrequencyInHours", + "type": "int", + }, + "replication_interval": {"key": "replicationInterval", "type": "int"}, + "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, + "encryption": {"key": "encryption", "type": "str"}, + "active_storage_account_id": {"key": "activeStorageAccountId", "type": "str"}, } def __init__( @@ -7083,8 +8815,26 @@ def __init__( active_storage_account_id: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzurePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + """ + :keyword recovery_point_history_duration_in_hours: The duration (in hours) to which point the + recovery history needs to be maintained. + :paramtype recovery_point_history_duration_in_hours: int + :keyword application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which + Hyper-V Replica should create an application consistent snapshot within the VM. + :paramtype application_consistent_snapshot_frequency_in_hours: int + :keyword replication_interval: The replication interval. + :paramtype replication_interval: int + :keyword online_replication_start_time: The scheduled start time for the initial replication. + If this parameter is Null, the initial replication starts immediately. + :paramtype online_replication_start_time: str + :keyword encryption: A value indicating whether encryption is enabled for virtual machines in + this cloud. + :paramtype encryption: str + :keyword active_storage_account_id: The active storage account Id. + :paramtype active_storage_account_id: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.recovery_point_history_duration_in_hours = recovery_point_history_duration_in_hours self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours self.replication_interval = replication_interval @@ -7098,35 +8848,38 @@ class HyperVReplicaAzurePolicyInput(PolicyProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_history_duration: The duration (in hours) to which point the recovery + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_history_duration: The duration (in hours) to which point the recovery history needs to be maintained. - :type recovery_point_history_duration: int - :param application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which + :vartype recovery_point_history_duration: int + :ivar application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM. - :type application_consistent_snapshot_frequency_in_hours: int - :param replication_interval: The replication interval. - :type replication_interval: int - :param online_replication_start_time: The scheduled start time for the initial replication. If + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar replication_interval: The replication interval. + :vartype replication_interval: int + :ivar online_replication_start_time: The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately. - :type online_replication_start_time: str - :param storage_accounts: The list of storage accounts to which the VMs in the primary cloud can + :vartype online_replication_start_time: str + :ivar storage_accounts: The list of storage accounts to which the VMs in the primary cloud can replicate to. - :type storage_accounts: list[str] + :vartype storage_accounts: list[str] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_duration': {'key': 'recoveryPointHistoryDuration', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'replication_interval': {'key': 'replicationInterval', 'type': 'int'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'storage_accounts': {'key': 'storageAccounts', 'type': '[str]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_history_duration": {"key": "recoveryPointHistoryDuration", "type": "int"}, + "application_consistent_snapshot_frequency_in_hours": { + "key": "applicationConsistentSnapshotFrequencyInHours", + "type": "int", + }, + "replication_interval": {"key": "replicationInterval", "type": "int"}, + "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, + "storage_accounts": {"key": "storageAccounts", "type": "[str]"}, } def __init__( @@ -7139,8 +8892,24 @@ def __init__( storage_accounts: Optional[List[str]] = None, **kwargs ): - super(HyperVReplicaAzurePolicyInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + """ + :keyword recovery_point_history_duration: The duration (in hours) to which point the recovery + history needs to be maintained. + :paramtype recovery_point_history_duration: int + :keyword application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which + Hyper-V Replica should create an application consistent snapshot within the VM. + :paramtype application_consistent_snapshot_frequency_in_hours: int + :keyword replication_interval: The replication interval. + :paramtype replication_interval: int + :keyword online_replication_start_time: The scheduled start time for the initial replication. + If this parameter is Null, the initial replication starts immediately. + :paramtype online_replication_start_time: str + :keyword storage_accounts: The list of storage accounts to which the VMs in the primary cloud + can replicate to. + :paramtype storage_accounts: list[str] + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.recovery_point_history_duration = recovery_point_history_duration self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours self.replication_interval = replication_interval @@ -7148,137 +8917,139 @@ def __init__( self.storage_accounts = storage_accounts -class HyperVReplicaAzureReplicationDetails(ReplicationProviderSpecificSettings): +class HyperVReplicaAzureReplicationDetails( + ReplicationProviderSpecificSettings +): # pylint: disable=too-many-instance-attributes """Hyper V Replica Azure provider specific settings. 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. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param azure_vm_disk_details: Azure VM Disk details. - :type azure_vm_disk_details: + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar azure_vm_disk_details: Azure VM Disk details. + :vartype azure_vm_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] - :param recovery_azure_vm_name: Recovery Azure given name. - :type recovery_azure_vm_name: str - :param recovery_azure_vm_size: The Recovery Azure VM size. - :type recovery_azure_vm_size: str - :param recovery_azure_storage_account: The recovery Azure storage account. - :type recovery_azure_storage_account: str - :param recovery_azure_log_storage_account_id: The ARM id of the log storage account used for + :ivar recovery_azure_vm_name: Recovery Azure given name. + :vartype recovery_azure_vm_name: str + :ivar recovery_azure_vm_size: The Recovery Azure VM size. + :vartype recovery_azure_vm_size: str + :ivar recovery_azure_storage_account: The recovery Azure storage account. + :vartype recovery_azure_storage_account: str + :ivar recovery_azure_log_storage_account_id: The ARM id of the log storage account used for replication. This will be set to null if no log storage account was provided during enable protection. - :type recovery_azure_log_storage_account_id: str - :param last_replicated_time: The Last replication time. - :type last_replicated_time: ~datetime.datetime - :param rpo_in_seconds: Last RPO value. - :type rpo_in_seconds: long - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param initial_replication_details: Initial replication details. - :type initial_replication_details: + :vartype recovery_azure_log_storage_account_id: str + :ivar last_replicated_time: The Last replication time. + :vartype last_replicated_time: ~datetime.datetime + :ivar rpo_in_seconds: Last RPO value. + :vartype rpo_in_seconds: int + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar initial_replication_details: Initial replication details. + :vartype initial_replication_details: ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param selected_recovery_azure_network_id: The selected recovery azure network Id. - :type selected_recovery_azure_network_id: str - :param selected_source_nic_id: The selected source nic Id which will be used as the primary nic + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar selected_recovery_azure_network_id: The selected recovery azure network Id. + :vartype selected_recovery_azure_network_id: str + :ivar selected_source_nic_id: The selected source nic Id which will be used as the primary nic during failover. - :type selected_source_nic_id: str - :param encryption: The encryption info. - :type encryption: str - :param o_s_details: The operating system info. - :type o_s_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :param source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :type source_vm_ram_size_in_mb: int - :param source_vm_cpu_count: The CPU count of the VM on the primary side. - :type source_vm_cpu_count: int - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after + :vartype selected_source_nic_id: str + :ivar encryption: The encryption info. + :vartype encryption: str + :ivar o_s_details: The operating system info. + :vartype o_s_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails + :ivar source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. + :vartype source_vm_ram_size_in_mb: int + :ivar source_vm_cpu_count: The CPU count of the VM on the primary side. + :vartype source_vm_cpu_count: int + :ivar enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param recovery_azure_resource_group_id: The target resource group Id. - :type recovery_azure_resource_group_id: str - :param recovery_availability_set_id: The recovery availability set Id. - :type recovery_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during + :vartype enable_rdp_on_target_option: str + :ivar recovery_azure_resource_group_id: The target resource group Id. + :vartype recovery_azure_resource_group_id: str + :ivar recovery_availability_set_id: The recovery availability set Id. + :vartype recovery_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during failover. - :type use_managed_disks: str - :param license_type: License Type of the VM to be used. - :type license_type: str - :param sql_server_license_type: The SQL Server license type. - :type sql_server_license_type: str + :vartype use_managed_disks: str + :ivar license_type: License Type of the VM to be used. + :vartype license_type: str + :ivar sql_server_license_type: The SQL Server license type. + :vartype sql_server_license_type: str :ivar last_recovery_point_received: The last recovery point received time. :vartype last_recovery_point_received: ~datetime.datetime - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_managed_disk_tags: The tags for the seed managed disks. - :type seed_managed_disk_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - :param protected_managed_disks: The list of protected managed disks. - :type protected_managed_disks: + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar protected_managed_disks: The list of protected managed disks. + :vartype protected_managed_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureManagedDiskDetails] """ _validation = { - 'instance_type': {'required': True}, - 'last_recovery_point_received': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'azure_vm_disk_details': {'key': 'azureVmDiskDetails', 'type': '[AzureVmDiskDetails]'}, - 'recovery_azure_vm_name': {'key': 'recoveryAzureVmName', 'type': 'str'}, - 'recovery_azure_vm_size': {'key': 'recoveryAzureVMSize', 'type': 'str'}, - 'recovery_azure_storage_account': {'key': 'recoveryAzureStorageAccount', 'type': 'str'}, - 'recovery_azure_log_storage_account_id': {'key': 'recoveryAzureLogStorageAccountId', 'type': 'str'}, - 'last_replicated_time': {'key': 'lastReplicatedTime', 'type': 'iso-8601'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'initial_replication_details': {'key': 'initialReplicationDetails', 'type': 'InitialReplicationDetails'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'selected_recovery_azure_network_id': {'key': 'selectedRecoveryAzureNetworkId', 'type': 'str'}, - 'selected_source_nic_id': {'key': 'selectedSourceNicId', 'type': 'str'}, - 'encryption': {'key': 'encryption', 'type': 'str'}, - 'o_s_details': {'key': 'oSDetails', 'type': 'OSDetails'}, - 'source_vm_ram_size_in_mb': {'key': 'sourceVmRamSizeInMB', 'type': 'int'}, - 'source_vm_cpu_count': {'key': 'sourceVmCpuCount', 'type': 'int'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'recovery_azure_resource_group_id': {'key': 'recoveryAzureResourceGroupId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'last_recovery_point_received': {'key': 'lastRecoveryPointReceived', 'type': 'iso-8601'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_managed_disk_tags': {'key': 'seedManagedDiskTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - 'protected_managed_disks': {'key': 'protectedManagedDisks', 'type': '[HyperVReplicaAzureManagedDiskDetails]'}, - } - - def __init__( - self, - *, - azure_vm_disk_details: Optional[List["AzureVmDiskDetails"]] = None, + "instance_type": {"required": True}, + "last_recovery_point_received": {"readonly": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "azure_vm_disk_details": {"key": "azureVmDiskDetails", "type": "[AzureVmDiskDetails]"}, + "recovery_azure_vm_name": {"key": "recoveryAzureVmName", "type": "str"}, + "recovery_azure_vm_size": {"key": "recoveryAzureVMSize", "type": "str"}, + "recovery_azure_storage_account": {"key": "recoveryAzureStorageAccount", "type": "str"}, + "recovery_azure_log_storage_account_id": {"key": "recoveryAzureLogStorageAccountId", "type": "str"}, + "last_replicated_time": {"key": "lastReplicatedTime", "type": "iso-8601"}, + "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, + "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, + "vm_id": {"key": "vmId", "type": "str"}, + "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, + "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, + "initial_replication_details": {"key": "initialReplicationDetails", "type": "InitialReplicationDetails"}, + "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, + "selected_recovery_azure_network_id": {"key": "selectedRecoveryAzureNetworkId", "type": "str"}, + "selected_source_nic_id": {"key": "selectedSourceNicId", "type": "str"}, + "encryption": {"key": "encryption", "type": "str"}, + "o_s_details": {"key": "oSDetails", "type": "OSDetails"}, + "source_vm_ram_size_in_mb": {"key": "sourceVmRamSizeInMB", "type": "int"}, + "source_vm_cpu_count": {"key": "sourceVmCpuCount", "type": "int"}, + "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, + "recovery_azure_resource_group_id": {"key": "recoveryAzureResourceGroupId", "type": "str"}, + "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, + "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, + "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, + "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "{str}"}, + "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, + "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, + "protected_managed_disks": {"key": "protectedManagedDisks", "type": "[HyperVReplicaAzureManagedDiskDetails]"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + azure_vm_disk_details: Optional[List["_models.AzureVmDiskDetails"]] = None, recovery_azure_vm_name: Optional[str] = None, recovery_azure_vm_size: Optional[str] = None, recovery_azure_storage_account: Optional[str] = None, @@ -7289,12 +9060,12 @@ def __init__( vm_id: Optional[str] = None, vm_protection_state: Optional[str] = None, vm_protection_state_description: Optional[str] = None, - initial_replication_details: Optional["InitialReplicationDetails"] = None, - vm_nics: Optional[List["VMNicDetails"]] = None, + initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, + vm_nics: Optional[List["_models.VMNicDetails"]] = None, selected_recovery_azure_network_id: Optional[str] = None, selected_source_nic_id: Optional[str] = None, encryption: Optional[str] = None, - o_s_details: Optional["OSDetails"] = None, + o_s_details: Optional["_models.OSDetails"] = None, source_vm_ram_size_in_mb: Optional[int] = None, source_vm_cpu_count: Optional[int] = None, enable_rdp_on_target_option: Optional[str] = None, @@ -7309,11 +9080,85 @@ def __init__( seed_managed_disk_tags: Optional[Dict[str, str]] = None, target_managed_disk_tags: Optional[Dict[str, str]] = None, target_nic_tags: Optional[Dict[str, str]] = None, - protected_managed_disks: Optional[List["HyperVReplicaAzureManagedDiskDetails"]] = None, - **kwargs - ): - super(HyperVReplicaAzureReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + protected_managed_disks: Optional[List["_models.HyperVReplicaAzureManagedDiskDetails"]] = None, + **kwargs + ): + """ + :keyword azure_vm_disk_details: Azure VM Disk details. + :paramtype azure_vm_disk_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] + :keyword recovery_azure_vm_name: Recovery Azure given name. + :paramtype recovery_azure_vm_name: str + :keyword recovery_azure_vm_size: The Recovery Azure VM size. + :paramtype recovery_azure_vm_size: str + :keyword recovery_azure_storage_account: The recovery Azure storage account. + :paramtype recovery_azure_storage_account: str + :keyword recovery_azure_log_storage_account_id: The ARM id of the log storage account used for + replication. This will be set to null if no log storage account was provided during enable + protection. + :paramtype recovery_azure_log_storage_account_id: str + :keyword last_replicated_time: The Last replication time. + :paramtype last_replicated_time: ~datetime.datetime + :keyword rpo_in_seconds: Last RPO value. + :paramtype rpo_in_seconds: int + :keyword last_rpo_calculated_time: The last RPO calculated time. + :paramtype last_rpo_calculated_time: ~datetime.datetime + :keyword vm_id: The virtual machine Id. + :paramtype vm_id: str + :keyword vm_protection_state: The protection state for the vm. + :paramtype vm_protection_state: str + :keyword vm_protection_state_description: The protection state description for the vm. + :paramtype vm_protection_state_description: str + :keyword initial_replication_details: Initial replication details. + :paramtype initial_replication_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :keyword vm_nics: The PE Network details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :keyword selected_recovery_azure_network_id: The selected recovery azure network Id. + :paramtype selected_recovery_azure_network_id: str + :keyword selected_source_nic_id: The selected source nic Id which will be used as the primary + nic during failover. + :paramtype selected_source_nic_id: str + :keyword encryption: The encryption info. + :paramtype encryption: str + :keyword o_s_details: The operating system info. + :paramtype o_s_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails + :keyword source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. + :paramtype source_vm_ram_size_in_mb: int + :keyword source_vm_cpu_count: The CPU count of the VM on the primary side. + :paramtype source_vm_cpu_count: int + :keyword enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :paramtype enable_rdp_on_target_option: str + :keyword recovery_azure_resource_group_id: The target resource group Id. + :paramtype recovery_azure_resource_group_id: str + :keyword recovery_availability_set_id: The recovery availability set Id. + :paramtype recovery_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_proximity_placement_group_id: The target proximity placement group Id. + :paramtype target_proximity_placement_group_id: str + :keyword use_managed_disks: A value indicating whether managed disks should be used during + failover. + :paramtype use_managed_disks: str + :keyword license_type: License Type of the VM to be used. + :paramtype license_type: str + :keyword sql_server_license_type: The SQL Server license type. + :paramtype sql_server_license_type: str + :keyword target_vm_tags: The target VM tags. + :paramtype target_vm_tags: dict[str, str] + :keyword seed_managed_disk_tags: The tags for the seed managed disks. + :paramtype seed_managed_disk_tags: dict[str, str] + :keyword target_managed_disk_tags: The tags for the target managed disks. + :paramtype target_managed_disk_tags: dict[str, str] + :keyword target_nic_tags: The tags for the target NICs. + :paramtype target_nic_tags: dict[str, str] + :keyword protected_managed_disks: The list of protected managed disks. + :paramtype protected_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureManagedDiskDetails] + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.azure_vm_disk_details = azure_vm_disk_details self.recovery_azure_vm_name = recovery_azure_vm_name self.recovery_azure_vm_size = recovery_azure_vm_size @@ -7354,34 +9199,34 @@ class HyperVReplicaAzureReprotectInput(ReverseReplicationProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param hv_host_vm_id: The Hyper-V host Vm Id. - :type hv_host_vm_id: str - :param vm_name: The Vm Name. - :type vm_name: str - :param os_type: The OS type associated with vm. - :type os_type: str - :param v_hd_id: The OS disk VHD id associated with vm. - :type v_hd_id: str - :param storage_account_id: The storage account name. - :type storage_account_id: str - :param log_storage_account_id: The storage account to be used for logging during replication. - :type log_storage_account_id: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar hv_host_vm_id: The Hyper-V host Vm Id. + :vartype hv_host_vm_id: str + :ivar vm_name: The Vm Name. + :vartype vm_name: str + :ivar os_type: The OS type associated with vm. + :vartype os_type: str + :ivar v_hd_id: The OS disk VHD id associated with vm. + :vartype v_hd_id: str + :ivar storage_account_id: The storage account name. + :vartype storage_account_id: str + :ivar log_storage_account_id: The storage account to be used for logging during replication. + :vartype log_storage_account_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'hv_host_vm_id': {'key': 'hvHostVmId', 'type': 'str'}, - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'v_hd_id': {'key': 'vHDId', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "hv_host_vm_id": {"key": "hvHostVmId", "type": "str"}, + "vm_name": {"key": "vmName", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "v_hd_id": {"key": "vHDId", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, } def __init__( @@ -7395,8 +9240,22 @@ def __init__( log_storage_account_id: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzureReprotectInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + """ + :keyword hv_host_vm_id: The Hyper-V host Vm Id. + :paramtype hv_host_vm_id: str + :keyword vm_name: The Vm Name. + :paramtype vm_name: str + :keyword os_type: The OS type associated with vm. + :paramtype os_type: str + :keyword v_hd_id: The OS disk VHD id associated with vm. + :paramtype v_hd_id: str + :keyword storage_account_id: The storage account name. + :paramtype storage_account_id: str + :keyword log_storage_account_id: The storage account to be used for logging during replication. + :paramtype log_storage_account_id: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.hv_host_vm_id = hv_host_vm_id self.vm_name = vm_name self.os_type = os_type @@ -7410,26 +9269,26 @@ class HyperVReplicaAzureTestFailoverInput(TestFailoverProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: Primary kek certificate pfx. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :type secondary_kek_certificate_pfx: str - :param recovery_point_id: The recovery point id to be passed to test failover to a particular + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar primary_kek_certificate_pfx: Primary kek certificate pfx. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: Secondary kek certificate pfx. + :vartype secondary_kek_certificate_pfx: str + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, + "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } def __init__( @@ -7440,8 +9299,17 @@ def __init__( recovery_point_id: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzureTestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + """ + :keyword primary_kek_certificate_pfx: Primary kek certificate pfx. + :paramtype primary_kek_certificate_pfx: str + :keyword secondary_kek_certificate_pfx: Secondary kek certificate pfx. + :paramtype secondary_kek_certificate_pfx: str + :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.primary_kek_certificate_pfx = primary_kek_certificate_pfx self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx self.recovery_point_id = recovery_point_id @@ -7452,26 +9320,26 @@ class HyperVReplicaAzureUnplannedFailoverInput(UnplannedFailoverProviderSpecific All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: Primary kek certificate pfx. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :type secondary_kek_certificate_pfx: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar primary_kek_certificate_pfx: Primary kek certificate pfx. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: Secondary kek certificate pfx. + :vartype secondary_kek_certificate_pfx: str + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, + "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } def __init__( @@ -7482,67 +9350,78 @@ def __init__( recovery_point_id: Optional[str] = None, **kwargs ): - super(HyperVReplicaAzureUnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + """ + :keyword primary_kek_certificate_pfx: Primary kek certificate pfx. + :paramtype primary_kek_certificate_pfx: str + :keyword secondary_kek_certificate_pfx: Secondary kek certificate pfx. + :paramtype secondary_kek_certificate_pfx: str + :keyword recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.primary_kek_certificate_pfx = primary_kek_certificate_pfx self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx self.recovery_point_id = recovery_point_id -class HyperVReplicaAzureUpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProviderInput): +class HyperVReplicaAzureUpdateReplicationProtectedItemInput( + UpdateReplicationProtectedItemProviderInput +): # pylint: disable=too-many-instance-attributes """HyperV replica Azure input to update replication protected item. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic deployment. - :type recovery_azure_v1_resource_group_id: str - :param recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource + :vartype recovery_azure_v1_resource_group_id: str + :ivar recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource manager deployment. - :type recovery_azure_v2_resource_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during + :vartype recovery_azure_v2_resource_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during failover. - :type use_managed_disks: str - :param disk_id_to_disk_encryption_map: The dictionary of disk resource Id to disk encryption - set ARM Id. - :type disk_id_to_disk_encryption_map: dict[str, str] - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or + :vartype use_managed_disks: str + :ivar disk_id_to_disk_encryption_map: The dictionary of disk resource Id to disk encryption set + ARM Id. + :vartype disk_id_to_disk_encryption_map: dict[str, str] + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param vm_disks: The list of disk update properties. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] + :ivar vm_disks: The list of disk update properties. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_azure_v1_resource_group_id': {'key': 'recoveryAzureV1ResourceGroupId', 'type': 'str'}, - 'recovery_azure_v2_resource_group_id': {'key': 'recoveryAzureV2ResourceGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'disk_id_to_disk_encryption_map': {'key': 'diskIdToDiskEncryptionMap', 'type': '{str}'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[UpdateDiskInput]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_azure_v1_resource_group_id": {"key": "recoveryAzureV1ResourceGroupId", "type": "str"}, + "recovery_azure_v2_resource_group_id": {"key": "recoveryAzureV2ResourceGroupId", "type": "str"}, + "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, + "disk_id_to_disk_encryption_map": {"key": "diskIdToDiskEncryptionMap", "type": "{str}"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, + "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, + "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, + "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, + "vm_disks": {"key": "vmDisks", "type": "[UpdateDiskInput]"}, } def __init__( @@ -7557,12 +9436,42 @@ def __init__( target_vm_tags: Optional[Dict[str, str]] = None, target_managed_disk_tags: Optional[Dict[str, str]] = None, target_nic_tags: Optional[Dict[str, str]] = None, - sql_server_license_type: Optional[Union[str, "SqlServerLicenseType"]] = None, - vm_disks: Optional[List["UpdateDiskInput"]] = None, - **kwargs - ): - super(HyperVReplicaAzureUpdateReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + vm_disks: Optional[List["_models.UpdateDiskInput"]] = None, + **kwargs + ): + """ + :keyword recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic + deployment. + :paramtype recovery_azure_v1_resource_group_id: str + :keyword recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource + manager deployment. + :paramtype recovery_azure_v2_resource_group_id: str + :keyword use_managed_disks: A value indicating whether managed disks should be used during + failover. + :paramtype use_managed_disks: str + :keyword disk_id_to_disk_encryption_map: The dictionary of disk resource Id to disk encryption + set ARM Id. + :paramtype disk_id_to_disk_encryption_map: dict[str, str] + :keyword target_proximity_placement_group_id: The target proximity placement group Id. + :paramtype target_proximity_placement_group_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_vm_tags: The target VM tags. + :paramtype target_vm_tags: dict[str, str] + :keyword target_managed_disk_tags: The tags for the target managed disks. + :paramtype target_managed_disk_tags: dict[str, str] + :keyword target_nic_tags: The tags for the target NICs. + :paramtype target_nic_tags: dict[str, str] + :keyword sql_server_license_type: The SQL Server license type. Known values are: + "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". + :paramtype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :keyword vm_disks: The list of disk update properties. + :paramtype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.recovery_azure_v1_resource_group_id = recovery_azure_v1_resource_group_id self.recovery_azure_v2_resource_group_id = recovery_azure_v2_resource_group_id self.use_managed_disks = use_managed_disks @@ -7581,29 +9490,28 @@ class HyperVReplicaBaseEventDetails(EventProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param container_name: The container friendly name. - :type container_name: str - :param fabric_name: The fabric friendly name. - :type fabric_name: str - :param remote_container_name: The remote container name. - :type remote_container_name: str - :param remote_fabric_name: The remote fabric name. - :type remote_fabric_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar container_name: The container friendly name. + :vartype container_name: str + :ivar fabric_name: The fabric friendly name. + :vartype fabric_name: str + :ivar remote_container_name: The remote container name. + :vartype remote_container_name: str + :ivar remote_fabric_name: The remote fabric name. + :vartype remote_fabric_name: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'remote_container_name': {'key': 'remoteContainerName', 'type': 'str'}, - 'remote_fabric_name': {'key': 'remoteFabricName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "remote_container_name": {"key": "remoteContainerName", "type": "str"}, + "remote_fabric_name": {"key": "remoteFabricName", "type": "str"}, } def __init__( @@ -7615,62 +9523,74 @@ def __init__( remote_fabric_name: Optional[str] = None, **kwargs ): - super(HyperVReplicaBaseEventDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaBaseEventDetails' # type: str + """ + :keyword container_name: The container friendly name. + :paramtype container_name: str + :keyword fabric_name: The fabric friendly name. + :paramtype fabric_name: str + :keyword remote_container_name: The remote container name. + :paramtype remote_container_name: str + :keyword remote_fabric_name: The remote fabric name. + :paramtype remote_fabric_name: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaBaseEventDetails" # type: str self.container_name = container_name self.fabric_name = fabric_name self.remote_container_name = remote_container_name self.remote_fabric_name = remote_fabric_name -class HyperVReplicaBasePolicyDetails(PolicyProviderSpecificDetails): +class HyperVReplicaBasePolicyDetails(PolicyProviderSpecificDetails): # pylint: disable=too-many-instance-attributes """Base class for HyperVReplica policy details. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion_option: A value indicating whether the VM has to be auto deleted. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion_option: A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud. - :type replica_deletion_option: str + :vartype replica_deletion_option: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion_option': {'key': 'replicaDeletionOption', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_points": {"key": "recoveryPoints", "type": "int"}, + "application_consistent_snapshot_frequency_in_hours": { + "key": "applicationConsistentSnapshotFrequencyInHours", + "type": "int", + }, + "compression": {"key": "compression", "type": "str"}, + "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, + "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, + "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, + "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, + "replication_port": {"key": "replicationPort", "type": "int"}, + "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, + "replica_deletion_option": {"key": "replicaDeletionOption", "type": "str"}, } def __init__( @@ -7688,8 +9608,32 @@ def __init__( replica_deletion_option: Optional[str] = None, **kwargs ): - super(HyperVReplicaBasePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaBasePolicyDetails' # type: str + """ + :keyword recovery_points: A value indicating the number of recovery points. + :paramtype recovery_points: int + :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :paramtype application_consistent_snapshot_frequency_in_hours: int + :keyword compression: A value indicating whether compression has to be enabled. + :paramtype compression: str + :keyword initial_replication_method: A value indicating whether IR is online. + :paramtype initial_replication_method: str + :keyword online_replication_start_time: A value indicating the online IR start time. + :paramtype online_replication_start_time: str + :keyword offline_replication_import_path: A value indicating the offline IR import path. + :paramtype offline_replication_import_path: str + :keyword offline_replication_export_path: A value indicating the offline IR export path. + :paramtype offline_replication_export_path: str + :keyword replication_port: A value indicating the recovery HTTPS port. + :paramtype replication_port: int + :keyword allowed_authentication_type: A value indicating the authentication type. + :paramtype allowed_authentication_type: int + :keyword replica_deletion_option: A value indicating whether the VM has to be auto deleted. + Supported Values: String.Empty, None, OnRecoveryCloud. + :paramtype replica_deletion_option: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaBasePolicyDetails" # type: str self.recovery_points = recovery_points self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours self.compression = compression @@ -7707,54 +9651,71 @@ class HyperVReplicaBaseReplicationDetails(ReplicationProviderSpecificSettings): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param last_replicated_time: The Last replication time. - :type last_replicated_time: ~datetime.datetime - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param initial_replication_details: Initial replication details. - :type initial_replication_details: + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar last_replicated_time: The Last replication time. + :vartype last_replicated_time: ~datetime.datetime + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar initial_replication_details: Initial replication details. + :vartype initial_replication_details: ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param v_m_disk_details: VM disk details. - :type v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar v_m_disk_details: VM disk details. + :vartype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'last_replicated_time': {'key': 'lastReplicatedTime', 'type': 'iso-8601'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'initial_replication_details': {'key': 'initialReplicationDetails', 'type': 'InitialReplicationDetails'}, - 'v_m_disk_details': {'key': 'vMDiskDetails', 'type': '[DiskDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "last_replicated_time": {"key": "lastReplicatedTime", "type": "iso-8601"}, + "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, + "vm_id": {"key": "vmId", "type": "str"}, + "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, + "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, + "initial_replication_details": {"key": "initialReplicationDetails", "type": "InitialReplicationDetails"}, + "v_m_disk_details": {"key": "vMDiskDetails", "type": "[DiskDetails]"}, } def __init__( self, *, last_replicated_time: Optional[datetime.datetime] = None, - vm_nics: Optional[List["VMNicDetails"]] = None, + vm_nics: Optional[List["_models.VMNicDetails"]] = None, vm_id: Optional[str] = None, vm_protection_state: Optional[str] = None, vm_protection_state_description: Optional[str] = None, - initial_replication_details: Optional["InitialReplicationDetails"] = None, - v_m_disk_details: Optional[List["DiskDetails"]] = None, - **kwargs - ): - super(HyperVReplicaBaseReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaBaseReplicationDetails' # type: str + initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, + v_m_disk_details: Optional[List["_models.DiskDetails"]] = None, + **kwargs + ): + """ + :keyword last_replicated_time: The Last replication time. + :paramtype last_replicated_time: ~datetime.datetime + :keyword vm_nics: The PE Network details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :keyword vm_id: The virtual machine Id. + :paramtype vm_id: str + :keyword vm_protection_state: The protection state for the vm. + :paramtype vm_protection_state: str + :keyword vm_protection_state_description: The protection state description for the vm. + :paramtype vm_protection_state_description: str + :keyword initial_replication_details: Initial replication details. + :paramtype initial_replication_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :keyword v_m_disk_details: VM disk details. + :paramtype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaBaseReplicationDetails" # type: str self.last_replicated_time = last_replicated_time self.vm_nics = vm_nics self.vm_id = vm_id @@ -7764,57 +9725,59 @@ def __init__( self.v_m_disk_details = v_m_disk_details -class HyperVReplicaBluePolicyDetails(PolicyProviderSpecificDetails): +class HyperVReplicaBluePolicyDetails(PolicyProviderSpecificDetails): # pylint: disable=too-many-instance-attributes """Hyper-V Replica Blue specific protection profile details. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param replication_frequency_in_seconds: A value indicating the replication interval. - :type replication_frequency_in_seconds: int - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar replication_frequency_in_seconds: A value indicating the replication interval. + :vartype replication_frequency_in_seconds: int + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion_option: A value indicating whether the VM has to be auto deleted. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion_option: A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud. - :type replica_deletion_option: str + :vartype replica_deletion_option: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'replication_frequency_in_seconds': {'key': 'replicationFrequencyInSeconds', 'type': 'int'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion_option': {'key': 'replicaDeletionOption', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "replication_frequency_in_seconds": {"key": "replicationFrequencyInSeconds", "type": "int"}, + "recovery_points": {"key": "recoveryPoints", "type": "int"}, + "application_consistent_snapshot_frequency_in_hours": { + "key": "applicationConsistentSnapshotFrequencyInHours", + "type": "int", + }, + "compression": {"key": "compression", "type": "str"}, + "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, + "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, + "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, + "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, + "replication_port": {"key": "replicationPort", "type": "int"}, + "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, + "replica_deletion_option": {"key": "replicaDeletionOption", "type": "str"}, } def __init__( @@ -7833,8 +9796,34 @@ def __init__( replica_deletion_option: Optional[str] = None, **kwargs ): - super(HyperVReplicaBluePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012R2' # type: str + """ + :keyword replication_frequency_in_seconds: A value indicating the replication interval. + :paramtype replication_frequency_in_seconds: int + :keyword recovery_points: A value indicating the number of recovery points. + :paramtype recovery_points: int + :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :paramtype application_consistent_snapshot_frequency_in_hours: int + :keyword compression: A value indicating whether compression has to be enabled. + :paramtype compression: str + :keyword initial_replication_method: A value indicating whether IR is online. + :paramtype initial_replication_method: str + :keyword online_replication_start_time: A value indicating the online IR start time. + :paramtype online_replication_start_time: str + :keyword offline_replication_import_path: A value indicating the offline IR import path. + :paramtype offline_replication_import_path: str + :keyword offline_replication_export_path: A value indicating the offline IR export path. + :paramtype offline_replication_export_path: str + :keyword replication_port: A value indicating the recovery HTTPS port. + :paramtype replication_port: int + :keyword allowed_authentication_type: A value indicating the authentication type. + :paramtype allowed_authentication_type: int + :keyword replica_deletion_option: A value indicating whether the VM has to be auto deleted. + Supported Values: String.Empty, None, OnRecoveryCloud. + :paramtype replica_deletion_option: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplica2012R2" # type: str self.replication_frequency_in_seconds = replication_frequency_in_seconds self.recovery_points = recovery_points self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours @@ -7848,61 +9837,62 @@ def __init__( self.replica_deletion_option = replica_deletion_option -class HyperVReplicaPolicyInput(PolicyProviderSpecificInput): +class HyperVReplicaPolicyInput(PolicyProviderSpecificInput): # pylint: disable=too-many-instance-attributes """Hyper-V Replica specific policy Input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: HyperVReplicaBluePolicyInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVReplicaBluePolicyInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion: A value indicating whether the VM has to be auto deleted. - :type replica_deletion: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion': {'key': 'replicaDeletion', 'type': 'str'}, + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion: A value indicating whether the VM has to be auto deleted. + :vartype replica_deletion: str + """ + + _validation = { + "instance_type": {"required": True}, } - _subtype_map = { - 'instance_type': {'HyperVReplica2012R2': 'HyperVReplicaBluePolicyInput'} + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_points": {"key": "recoveryPoints", "type": "int"}, + "application_consistent_snapshot_frequency_in_hours": { + "key": "applicationConsistentSnapshotFrequencyInHours", + "type": "int", + }, + "compression": {"key": "compression", "type": "str"}, + "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, + "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, + "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, + "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, + "replication_port": {"key": "replicationPort", "type": "int"}, + "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, + "replica_deletion": {"key": "replicaDeletion", "type": "str"}, } + _subtype_map = {"instance_type": {"HyperVReplica2012R2": "HyperVReplicaBluePolicyInput"}} + def __init__( self, *, @@ -7918,8 +9908,31 @@ def __init__( replica_deletion: Optional[str] = None, **kwargs ): - super(HyperVReplicaPolicyInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012' # type: str + """ + :keyword recovery_points: A value indicating the number of recovery points. + :paramtype recovery_points: int + :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :paramtype application_consistent_snapshot_frequency_in_hours: int + :keyword compression: A value indicating whether compression has to be enabled. + :paramtype compression: str + :keyword initial_replication_method: A value indicating whether IR is online. + :paramtype initial_replication_method: str + :keyword online_replication_start_time: A value indicating the online IR start time. + :paramtype online_replication_start_time: str + :keyword offline_replication_import_path: A value indicating the offline IR import path. + :paramtype offline_replication_import_path: str + :keyword offline_replication_export_path: A value indicating the offline IR export path. + :paramtype offline_replication_export_path: str + :keyword replication_port: A value indicating the recovery HTTPS port. + :paramtype replication_port: int + :keyword allowed_authentication_type: A value indicating the authentication type. + :paramtype allowed_authentication_type: int + :keyword replica_deletion: A value indicating whether the VM has to be auto deleted. + :paramtype replica_deletion: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplica2012" # type: str self.recovery_points = recovery_points self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours self.compression = compression @@ -7932,55 +9945,58 @@ def __init__( self.replica_deletion = replica_deletion -class HyperVReplicaBluePolicyInput(HyperVReplicaPolicyInput): +class HyperVReplicaBluePolicyInput(HyperVReplicaPolicyInput): # pylint: disable=too-many-instance-attributes """HyperV Replica Blue policy input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion: A value indicating whether the VM has to be auto deleted. - :type replica_deletion: str - :param replication_frequency_in_seconds: A value indicating the replication interval. - :type replication_frequency_in_seconds: int - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion': {'key': 'replicaDeletion', 'type': 'str'}, - 'replication_frequency_in_seconds': {'key': 'replicationFrequencyInSeconds', 'type': 'int'}, + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion: A value indicating whether the VM has to be auto deleted. + :vartype replica_deletion: str + :ivar replication_frequency_in_seconds: A value indicating the replication interval. + :vartype replication_frequency_in_seconds: int + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_points": {"key": "recoveryPoints", "type": "int"}, + "application_consistent_snapshot_frequency_in_hours": { + "key": "applicationConsistentSnapshotFrequencyInHours", + "type": "int", + }, + "compression": {"key": "compression", "type": "str"}, + "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, + "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, + "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, + "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, + "replication_port": {"key": "replicationPort", "type": "int"}, + "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, + "replica_deletion": {"key": "replicaDeletion", "type": "str"}, + "replication_frequency_in_seconds": {"key": "replicationFrequencyInSeconds", "type": "int"}, } def __init__( @@ -7999,8 +10015,45 @@ def __init__( replication_frequency_in_seconds: Optional[int] = None, **kwargs ): - super(HyperVReplicaBluePolicyInput, self).__init__(recovery_points=recovery_points, application_consistent_snapshot_frequency_in_hours=application_consistent_snapshot_frequency_in_hours, compression=compression, initial_replication_method=initial_replication_method, online_replication_start_time=online_replication_start_time, offline_replication_import_path=offline_replication_import_path, offline_replication_export_path=offline_replication_export_path, replication_port=replication_port, allowed_authentication_type=allowed_authentication_type, replica_deletion=replica_deletion, **kwargs) - self.instance_type = 'HyperVReplica2012R2' # type: str + """ + :keyword recovery_points: A value indicating the number of recovery points. + :paramtype recovery_points: int + :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :paramtype application_consistent_snapshot_frequency_in_hours: int + :keyword compression: A value indicating whether compression has to be enabled. + :paramtype compression: str + :keyword initial_replication_method: A value indicating whether IR is online. + :paramtype initial_replication_method: str + :keyword online_replication_start_time: A value indicating the online IR start time. + :paramtype online_replication_start_time: str + :keyword offline_replication_import_path: A value indicating the offline IR import path. + :paramtype offline_replication_import_path: str + :keyword offline_replication_export_path: A value indicating the offline IR export path. + :paramtype offline_replication_export_path: str + :keyword replication_port: A value indicating the recovery HTTPS port. + :paramtype replication_port: int + :keyword allowed_authentication_type: A value indicating the authentication type. + :paramtype allowed_authentication_type: int + :keyword replica_deletion: A value indicating whether the VM has to be auto deleted. + :paramtype replica_deletion: str + :keyword replication_frequency_in_seconds: A value indicating the replication interval. + :paramtype replication_frequency_in_seconds: int + """ + super().__init__( + recovery_points=recovery_points, + application_consistent_snapshot_frequency_in_hours=application_consistent_snapshot_frequency_in_hours, + compression=compression, + initial_replication_method=initial_replication_method, + online_replication_start_time=online_replication_start_time, + offline_replication_import_path=offline_replication_import_path, + offline_replication_export_path=offline_replication_export_path, + replication_port=replication_port, + allowed_authentication_type=allowed_authentication_type, + replica_deletion=replica_deletion, + **kwargs + ) + self.instance_type = "HyperVReplica2012R2" # type: str self.replication_frequency_in_seconds = replication_frequency_in_seconds @@ -8009,54 +10062,71 @@ class HyperVReplicaBlueReplicationDetails(ReplicationProviderSpecificSettings): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param last_replicated_time: The Last replication time. - :type last_replicated_time: ~datetime.datetime - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param initial_replication_details: Initial replication details. - :type initial_replication_details: + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar last_replicated_time: The Last replication time. + :vartype last_replicated_time: ~datetime.datetime + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar initial_replication_details: Initial replication details. + :vartype initial_replication_details: ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param v_m_disk_details: VM disk details. - :type v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar v_m_disk_details: VM disk details. + :vartype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'last_replicated_time': {'key': 'lastReplicatedTime', 'type': 'iso-8601'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'initial_replication_details': {'key': 'initialReplicationDetails', 'type': 'InitialReplicationDetails'}, - 'v_m_disk_details': {'key': 'vMDiskDetails', 'type': '[DiskDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "last_replicated_time": {"key": "lastReplicatedTime", "type": "iso-8601"}, + "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, + "vm_id": {"key": "vmId", "type": "str"}, + "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, + "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, + "initial_replication_details": {"key": "initialReplicationDetails", "type": "InitialReplicationDetails"}, + "v_m_disk_details": {"key": "vMDiskDetails", "type": "[DiskDetails]"}, } def __init__( self, *, last_replicated_time: Optional[datetime.datetime] = None, - vm_nics: Optional[List["VMNicDetails"]] = None, + vm_nics: Optional[List["_models.VMNicDetails"]] = None, vm_id: Optional[str] = None, vm_protection_state: Optional[str] = None, vm_protection_state_description: Optional[str] = None, - initial_replication_details: Optional["InitialReplicationDetails"] = None, - v_m_disk_details: Optional[List["DiskDetails"]] = None, - **kwargs - ): - super(HyperVReplicaBlueReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012R2' # type: str + initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, + v_m_disk_details: Optional[List["_models.DiskDetails"]] = None, + **kwargs + ): + """ + :keyword last_replicated_time: The Last replication time. + :paramtype last_replicated_time: ~datetime.datetime + :keyword vm_nics: The PE Network details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :keyword vm_id: The virtual machine Id. + :paramtype vm_id: str + :keyword vm_protection_state: The protection state for the vm. + :paramtype vm_protection_state: str + :keyword vm_protection_state_description: The protection state description for the vm. + :paramtype vm_protection_state_description: str + :keyword initial_replication_details: Initial replication details. + :paramtype initial_replication_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :keyword v_m_disk_details: VM disk details. + :paramtype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplica2012R2" # type: str self.last_replicated_time = last_replicated_time self.vm_nics = vm_nics self.vm_id = vm_id @@ -8066,54 +10136,56 @@ def __init__( self.v_m_disk_details = v_m_disk_details -class HyperVReplicaPolicyDetails(PolicyProviderSpecificDetails): +class HyperVReplicaPolicyDetails(PolicyProviderSpecificDetails): # pylint: disable=too-many-instance-attributes """Hyper-V Replica Blue specific protection profile details. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_points: A value indicating the number of recovery points. - :type recovery_points: int - :param application_consistent_snapshot_frequency_in_hours: A value indicating the application + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application consistent frequency. - :type application_consistent_snapshot_frequency_in_hours: int - :param compression: A value indicating whether compression has to be enabled. - :type compression: str - :param initial_replication_method: A value indicating whether IR is online. - :type initial_replication_method: str - :param online_replication_start_time: A value indicating the online IR start time. - :type online_replication_start_time: str - :param offline_replication_import_path: A value indicating the offline IR import path. - :type offline_replication_import_path: str - :param offline_replication_export_path: A value indicating the offline IR export path. - :type offline_replication_export_path: str - :param replication_port: A value indicating the recovery HTTPS port. - :type replication_port: int - :param allowed_authentication_type: A value indicating the authentication type. - :type allowed_authentication_type: int - :param replica_deletion_option: A value indicating whether the VM has to be auto deleted. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion_option: A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud. - :type replica_deletion_option: str + :vartype replica_deletion_option: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_points': {'key': 'recoveryPoints', 'type': 'int'}, - 'application_consistent_snapshot_frequency_in_hours': {'key': 'applicationConsistentSnapshotFrequencyInHours', 'type': 'int'}, - 'compression': {'key': 'compression', 'type': 'str'}, - 'initial_replication_method': {'key': 'initialReplicationMethod', 'type': 'str'}, - 'online_replication_start_time': {'key': 'onlineReplicationStartTime', 'type': 'str'}, - 'offline_replication_import_path': {'key': 'offlineReplicationImportPath', 'type': 'str'}, - 'offline_replication_export_path': {'key': 'offlineReplicationExportPath', 'type': 'str'}, - 'replication_port': {'key': 'replicationPort', 'type': 'int'}, - 'allowed_authentication_type': {'key': 'allowedAuthenticationType', 'type': 'int'}, - 'replica_deletion_option': {'key': 'replicaDeletionOption', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_points": {"key": "recoveryPoints", "type": "int"}, + "application_consistent_snapshot_frequency_in_hours": { + "key": "applicationConsistentSnapshotFrequencyInHours", + "type": "int", + }, + "compression": {"key": "compression", "type": "str"}, + "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, + "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, + "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, + "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, + "replication_port": {"key": "replicationPort", "type": "int"}, + "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, + "replica_deletion_option": {"key": "replicaDeletionOption", "type": "str"}, } def __init__( @@ -8131,8 +10203,32 @@ def __init__( replica_deletion_option: Optional[str] = None, **kwargs ): - super(HyperVReplicaPolicyDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012' # type: str + """ + :keyword recovery_points: A value indicating the number of recovery points. + :paramtype recovery_points: int + :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :paramtype application_consistent_snapshot_frequency_in_hours: int + :keyword compression: A value indicating whether compression has to be enabled. + :paramtype compression: str + :keyword initial_replication_method: A value indicating whether IR is online. + :paramtype initial_replication_method: str + :keyword online_replication_start_time: A value indicating the online IR start time. + :paramtype online_replication_start_time: str + :keyword offline_replication_import_path: A value indicating the offline IR import path. + :paramtype offline_replication_import_path: str + :keyword offline_replication_export_path: A value indicating the offline IR export path. + :paramtype offline_replication_export_path: str + :keyword replication_port: A value indicating the recovery HTTPS port. + :paramtype replication_port: int + :keyword allowed_authentication_type: A value indicating the authentication type. + :paramtype allowed_authentication_type: int + :keyword replica_deletion_option: A value indicating whether the VM has to be auto deleted. + Supported Values: String.Empty, None, OnRecoveryCloud. + :paramtype replica_deletion_option: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplica2012" # type: str self.recovery_points = recovery_points self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours self.compression = compression @@ -8150,54 +10246,71 @@ class HyperVReplicaReplicationDetails(ReplicationProviderSpecificSettings): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param last_replicated_time: The Last replication time. - :type last_replicated_time: ~datetime.datetime - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param initial_replication_details: Initial replication details. - :type initial_replication_details: + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar last_replicated_time: The Last replication time. + :vartype last_replicated_time: ~datetime.datetime + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar initial_replication_details: Initial replication details. + :vartype initial_replication_details: ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param v_m_disk_details: VM disk details. - :type v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar v_m_disk_details: VM disk details. + :vartype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'last_replicated_time': {'key': 'lastReplicatedTime', 'type': 'iso-8601'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'initial_replication_details': {'key': 'initialReplicationDetails', 'type': 'InitialReplicationDetails'}, - 'v_m_disk_details': {'key': 'vMDiskDetails', 'type': '[DiskDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "last_replicated_time": {"key": "lastReplicatedTime", "type": "iso-8601"}, + "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, + "vm_id": {"key": "vmId", "type": "str"}, + "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, + "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, + "initial_replication_details": {"key": "initialReplicationDetails", "type": "InitialReplicationDetails"}, + "v_m_disk_details": {"key": "vMDiskDetails", "type": "[DiskDetails]"}, } def __init__( self, *, last_replicated_time: Optional[datetime.datetime] = None, - vm_nics: Optional[List["VMNicDetails"]] = None, + vm_nics: Optional[List["_models.VMNicDetails"]] = None, vm_id: Optional[str] = None, vm_protection_state: Optional[str] = None, vm_protection_state_description: Optional[str] = None, - initial_replication_details: Optional["InitialReplicationDetails"] = None, - v_m_disk_details: Optional[List["DiskDetails"]] = None, - **kwargs - ): - super(HyperVReplicaReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVReplica2012' # type: str + initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, + v_m_disk_details: Optional[List["_models.DiskDetails"]] = None, + **kwargs + ): + """ + :keyword last_replicated_time: The Last replication time. + :paramtype last_replicated_time: ~datetime.datetime + :keyword vm_nics: The PE Network details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :keyword vm_id: The virtual machine Id. + :paramtype vm_id: str + :keyword vm_protection_state: The protection state for the vm. + :paramtype vm_protection_state: str + :keyword vm_protection_state_description: The protection state description for the vm. + :paramtype vm_protection_state_description: str + :keyword initial_replication_details: Initial replication details. + :paramtype initial_replication_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :keyword v_m_disk_details: VM disk details. + :paramtype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplica2012" # type: str self.last_replicated_time = last_replicated_time self.vm_nics = vm_nics self.vm_id = vm_id @@ -8212,100 +10325,128 @@ class HyperVSiteDetails(FabricSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param hyper_v_hosts: The list of Hyper-V hosts associated with the fabric. - :type hyper_v_hosts: list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVHostDetails] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar hyper_v_hosts: The list of Hyper-V hosts associated with the fabric. + :vartype hyper_v_hosts: list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVHostDetails] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'hyper_v_hosts': {'key': 'hyperVHosts', 'type': '[HyperVHostDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "hyper_v_hosts": {"key": "hyperVHosts", "type": "[HyperVHostDetails]"}, } - def __init__( - self, - *, - hyper_v_hosts: Optional[List["HyperVHostDetails"]] = None, - **kwargs - ): - super(HyperVSiteDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVSite' # type: str + def __init__(self, *, hyper_v_hosts: Optional[List["_models.HyperVHostDetails"]] = None, **kwargs): + """ + :keyword hyper_v_hosts: The list of Hyper-V hosts associated with the fabric. + :paramtype hyper_v_hosts: + list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVHostDetails] + """ + super().__init__(**kwargs) + self.instance_type = "HyperVSite" # type: str self.hyper_v_hosts = hyper_v_hosts class HyperVVirtualMachineDetails(ConfigurationSettings): """Single Host fabric provider specific VM settings. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VmmVirtualMachineDetails. - - All required parameters must be populated in order to send to Azure. - - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param source_item_id: The source id of the object. - :type source_item_id: str - :param generation: The id of the object in fabric. - :type generation: str - :param os_details: The Last replication time. - :type os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :param disk_details: The Last successful failover time. - :type disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - :param has_physical_disk: A value indicating whether the VM has a physical disk attached. - String value of SrsDataContract.PresenceStatus enum. Possible values include: "Unknown", - "Present", "NotPresent". - :type has_physical_disk: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :param has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter - attached. String value of SrsDataContract.PresenceStatus enum. Possible values include: - "Unknown", "Present", "NotPresent". - :type has_fibre_channel_adapter: str or + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VmmVirtualMachineDetails + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar source_item_id: The source id of the object. + :vartype source_item_id: str + :ivar generation: The id of the object in fabric. + :vartype generation: str + :ivar os_details: The Last replication time. + :vartype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails + :ivar disk_details: The Last successful failover time. + :vartype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar has_physical_disk: A value indicating whether the VM has a physical disk attached. String + value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and + "NotPresent". + :vartype has_physical_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter + attached. String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", + "Present", and "NotPresent". + :vartype has_fibre_channel_adapter: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :param has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String - value of SrsDataContract.PresenceStatus enum. Possible values include: "Unknown", "Present", + :ivar has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String value + of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and "NotPresent". - :type has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :vartype has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar hyper_v_host_id: The Id of the hyper-v host in fabric. + :vartype hyper_v_host_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'source_item_id': {'key': 'sourceItemId', 'type': 'str'}, - 'generation': {'key': 'generation', 'type': 'str'}, - 'os_details': {'key': 'osDetails', 'type': 'OSDetails'}, - 'disk_details': {'key': 'diskDetails', 'type': '[DiskDetails]'}, - 'has_physical_disk': {'key': 'hasPhysicalDisk', 'type': 'str'}, - 'has_fibre_channel_adapter': {'key': 'hasFibreChannelAdapter', 'type': 'str'}, - 'has_shared_vhd': {'key': 'hasSharedVhd', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "source_item_id": {"key": "sourceItemId", "type": "str"}, + "generation": {"key": "generation", "type": "str"}, + "os_details": {"key": "osDetails", "type": "OSDetails"}, + "disk_details": {"key": "diskDetails", "type": "[DiskDetails]"}, + "has_physical_disk": {"key": "hasPhysicalDisk", "type": "str"}, + "has_fibre_channel_adapter": {"key": "hasFibreChannelAdapter", "type": "str"}, + "has_shared_vhd": {"key": "hasSharedVhd", "type": "str"}, + "hyper_v_host_id": {"key": "hyperVHostId", "type": "str"}, } - _subtype_map = { - 'instance_type': {'VmmVirtualMachine': 'VmmVirtualMachineDetails'} - } + _subtype_map = {"instance_type": {"VmmVirtualMachine": "VmmVirtualMachineDetails"}} def __init__( self, *, source_item_id: Optional[str] = None, generation: Optional[str] = None, - os_details: Optional["OSDetails"] = None, - disk_details: Optional[List["DiskDetails"]] = None, - has_physical_disk: Optional[Union[str, "PresenceStatus"]] = None, - has_fibre_channel_adapter: Optional[Union[str, "PresenceStatus"]] = None, - has_shared_vhd: Optional[Union[str, "PresenceStatus"]] = None, - **kwargs - ): - super(HyperVVirtualMachineDetails, self).__init__(**kwargs) - self.instance_type = 'HyperVVirtualMachine' # type: str + os_details: Optional["_models.OSDetails"] = None, + disk_details: Optional[List["_models.DiskDetails"]] = None, + has_physical_disk: Optional[Union[str, "_models.PresenceStatus"]] = None, + has_fibre_channel_adapter: Optional[Union[str, "_models.PresenceStatus"]] = None, + has_shared_vhd: Optional[Union[str, "_models.PresenceStatus"]] = None, + hyper_v_host_id: Optional[str] = None, + **kwargs + ): + """ + :keyword source_item_id: The source id of the object. + :paramtype source_item_id: str + :keyword generation: The id of the object in fabric. + :paramtype generation: str + :keyword os_details: The Last replication time. + :paramtype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails + :keyword disk_details: The Last successful failover time. + :paramtype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :keyword has_physical_disk: A value indicating whether the VM has a physical disk attached. + String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", + and "NotPresent". + :paramtype has_physical_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :keyword has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel + adapter attached. String value of SrsDataContract.PresenceStatus enum. Known values are: + "Unknown", "Present", and "NotPresent". + :paramtype has_fibre_channel_adapter: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :keyword has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String + value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and + "NotPresent". + :paramtype has_shared_vhd: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :keyword hyper_v_host_id: The Id of the hyper-v host in fabric. + :paramtype hyper_v_host_id: str + """ + super().__init__(**kwargs) + self.instance_type = "HyperVVirtualMachine" # type: str self.source_item_id = source_item_id self.generation = generation self.os_details = os_details @@ -8313,33 +10454,34 @@ def __init__( self.has_physical_disk = has_physical_disk self.has_fibre_channel_adapter = has_fibre_channel_adapter self.has_shared_vhd = has_shared_vhd + self.hyper_v_host_id = hyper_v_host_id -class IdentityProviderDetails(msrest.serialization.Model): +class IdentityProviderDetails(_serialization.Model): """Identity provider details. - :param tenant_id: The tenant Id for the service principal with which the on-premise + :ivar tenant_id: The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. - :type tenant_id: str - :param application_id: The application/client Id for the service principal with which the + :vartype tenant_id: str + :ivar application_id: The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. - :type application_id: str - :param object_id: The object Id of the service principal with which the on-premise + :vartype application_id: str + :ivar object_id: The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. - :type object_id: str - :param audience: The intended Audience of the service principal with which the on-premise + :vartype object_id: str + :ivar audience: The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. - :type audience: str - :param aad_authority: The base authority for Azure Active Directory authentication. - :type aad_authority: str + :vartype audience: str + :ivar aad_authority: The base authority for Azure Active Directory authentication. + :vartype aad_authority: str """ _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'application_id': {'key': 'applicationId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "application_id": {"key": "applicationId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + "audience": {"key": "audience", "type": "str"}, + "aad_authority": {"key": "aadAuthority", "type": "str"}, } def __init__( @@ -8352,7 +10494,23 @@ def __init__( aad_authority: Optional[str] = None, **kwargs ): - super(IdentityProviderDetails, self).__init__(**kwargs) + """ + :keyword tenant_id: The tenant Id for the service principal with which the on-premise + management/data plane components would communicate with our Azure services. + :paramtype tenant_id: str + :keyword application_id: The application/client Id for the service principal with which the + on-premise management/data plane components would communicate with our Azure services. + :paramtype application_id: str + :keyword object_id: The object Id of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. + :paramtype object_id: str + :keyword audience: The intended Audience of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. + :paramtype audience: str + :keyword aad_authority: The base authority for Azure Active Directory authentication. + :paramtype aad_authority: str + """ + super().__init__(**kwargs) self.tenant_id = tenant_id self.application_id = application_id self.object_id = object_id @@ -8360,54 +10518,65 @@ def __init__( self.aad_authority = aad_authority -class IdentityProviderInput(msrest.serialization.Model): +class IdentityProviderInput(_serialization.Model): """Identity provider input. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The tenant Id for the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :type tenant_id: str - :param application_id: Required. The application/client Id for the service principal with which - the on-premise management/data plane components would communicate with our Azure services. - :type application_id: str - :param object_id: Required. The object Id of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :type object_id: str - :param audience: Required. The intended Audience of the service principal with which the + :ivar tenant_id: The tenant Id for the service principal with which the on-premise + management/data plane components would communicate with our Azure services. Required. + :vartype tenant_id: str + :ivar application_id: The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. - :type audience: str - :param aad_authority: Required. The base authority for Azure Active Directory authentication. - :type aad_authority: str - """ - - _validation = { - 'tenant_id': {'required': True}, - 'application_id': {'required': True}, - 'object_id': {'required': True}, - 'audience': {'required': True}, - 'aad_authority': {'required': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'application_id': {'key': 'applicationId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - } - - def __init__( - self, - *, - tenant_id: str, - application_id: str, - object_id: str, - audience: str, - aad_authority: str, - **kwargs - ): - super(IdentityProviderInput, self).__init__(**kwargs) + Required. + :vartype application_id: str + :ivar object_id: The object Id of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. Required. + :vartype object_id: str + :ivar audience: The intended Audience of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. Required. + :vartype audience: str + :ivar aad_authority: The base authority for Azure Active Directory authentication. Required. + :vartype aad_authority: str + """ + + _validation = { + "tenant_id": {"required": True}, + "application_id": {"required": True}, + "object_id": {"required": True}, + "audience": {"required": True}, + "aad_authority": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "application_id": {"key": "applicationId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + "audience": {"key": "audience", "type": "str"}, + "aad_authority": {"key": "aadAuthority", "type": "str"}, + } + + def __init__( + self, *, tenant_id: str, application_id: str, object_id: str, audience: str, aad_authority: str, **kwargs + ): + """ + :keyword tenant_id: The tenant Id for the service principal with which the on-premise + management/data plane components would communicate with our Azure services. Required. + :paramtype tenant_id: str + :keyword application_id: The application/client Id for the service principal with which the + on-premise management/data plane components would communicate with our Azure services. + Required. + :paramtype application_id: str + :keyword object_id: The object Id of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. Required. + :paramtype object_id: str + :keyword audience: The intended Audience of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. Required. + :paramtype audience: str + :keyword aad_authority: The base authority for Azure Active Directory authentication. Required. + :paramtype aad_authority: str + """ + super().__init__(**kwargs) self.tenant_id = tenant_id self.application_id = application_id self.object_id = object_id @@ -8415,24 +10584,24 @@ def __init__( self.aad_authority = aad_authority -class InconsistentVmDetails(msrest.serialization.Model): +class InconsistentVmDetails(_serialization.Model): """This class stores the monitoring details for consistency check of inconsistent Protected Entity. - :param vm_name: The Vm name. - :type vm_name: str - :param cloud_name: The Cloud name. - :type cloud_name: str - :param details: The list of details regarding state of the Protected Entity in SRS and On prem. - :type details: list[str] - :param error_ids: The list of error ids. - :type error_ids: list[str] + :ivar vm_name: The Vm name. + :vartype vm_name: str + :ivar cloud_name: The Cloud name. + :vartype cloud_name: str + :ivar details: The list of details regarding state of the Protected Entity in SRS and On prem. + :vartype details: list[str] + :ivar error_ids: The list of error ids. + :vartype error_ids: list[str] """ _attribute_map = { - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'cloud_name': {'key': 'cloudName', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[str]'}, - 'error_ids': {'key': 'errorIds', 'type': '[str]'}, + "vm_name": {"key": "vmName", "type": "str"}, + "cloud_name": {"key": "cloudName", "type": "str"}, + "details": {"key": "details", "type": "[str]"}, + "error_ids": {"key": "errorIds", "type": "[str]"}, } def __init__( @@ -8444,25 +10613,36 @@ def __init__( error_ids: Optional[List[str]] = None, **kwargs ): - super(InconsistentVmDetails, self).__init__(**kwargs) + """ + :keyword vm_name: The Vm name. + :paramtype vm_name: str + :keyword cloud_name: The Cloud name. + :paramtype cloud_name: str + :keyword details: The list of details regarding state of the Protected Entity in SRS and On + prem. + :paramtype details: list[str] + :keyword error_ids: The list of error ids. + :paramtype error_ids: list[str] + """ + super().__init__(**kwargs) self.vm_name = vm_name self.cloud_name = cloud_name self.details = details self.error_ids = error_ids -class InitialReplicationDetails(msrest.serialization.Model): +class InitialReplicationDetails(_serialization.Model): """Initial replication details. - :param initial_replication_type: Initial replication type. - :type initial_replication_type: str - :param initial_replication_progress_percentage: The initial replication progress percentage. - :type initial_replication_progress_percentage: str + :ivar initial_replication_type: Initial replication type. + :vartype initial_replication_type: str + :ivar initial_replication_progress_percentage: The initial replication progress percentage. + :vartype initial_replication_progress_percentage: str """ _attribute_map = { - 'initial_replication_type': {'key': 'initialReplicationType', 'type': 'str'}, - 'initial_replication_progress_percentage': {'key': 'initialReplicationProgressPercentage', 'type': 'str'}, + "initial_replication_type": {"key": "initialReplicationType", "type": "str"}, + "initial_replication_progress_percentage": {"key": "initialReplicationProgressPercentage", "type": "str"}, } def __init__( @@ -8472,7 +10652,13 @@ def __init__( initial_replication_progress_percentage: Optional[str] = None, **kwargs ): - super(InitialReplicationDetails, self).__init__(**kwargs) + """ + :keyword initial_replication_type: Initial replication type. + :paramtype initial_replication_type: str + :keyword initial_replication_progress_percentage: The initial replication progress percentage. + :paramtype initial_replication_progress_percentage: str + """ + super().__init__(**kwargs) self.initial_replication_type = initial_replication_type self.initial_replication_progress_percentage = initial_replication_progress_percentage @@ -8482,55 +10668,61 @@ class InlineWorkflowTaskDetails(GroupTaskDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param child_tasks: The child tasks. - :type child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :param workflow_ids: The list of child workflow ids. - :type workflow_ids: list[str] + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar child_tasks: The child tasks. + :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :ivar workflow_ids: The list of child workflow ids. + :vartype workflow_ids: list[str] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'child_tasks': {'key': 'childTasks', 'type': '[ASRTask]'}, - 'workflow_ids': {'key': 'workflowIds', 'type': '[str]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "child_tasks": {"key": "childTasks", "type": "[ASRTask]"}, + "workflow_ids": {"key": "workflowIds", "type": "[str]"}, } def __init__( self, *, - child_tasks: Optional[List["ASRTask"]] = None, + child_tasks: Optional[List["_models.ASRTask"]] = None, workflow_ids: Optional[List[str]] = None, **kwargs ): - super(InlineWorkflowTaskDetails, self).__init__(child_tasks=child_tasks, **kwargs) - self.instance_type = 'InlineWorkflowTaskDetails' # type: str + """ + :keyword child_tasks: The child tasks. + :paramtype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :keyword workflow_ids: The list of child workflow ids. + :paramtype workflow_ids: list[str] + """ + super().__init__(child_tasks=child_tasks, **kwargs) + self.instance_type = "InlineWorkflowTaskDetails" # type: str self.workflow_ids = workflow_ids -class InMageAgentDetails(msrest.serialization.Model): +class InMageAgentDetails(_serialization.Model): """The details of the InMage agent. - :param agent_version: The agent version. - :type agent_version: str - :param agent_update_status: A value indicating whether installed agent needs to be updated. - :type agent_update_status: str - :param post_update_reboot_status: A value indicating whether reboot is required after update is + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar agent_update_status: A value indicating whether installed agent needs to be updated. + :vartype agent_update_status: str + :ivar post_update_reboot_status: A value indicating whether reboot is required after update is applied. - :type post_update_reboot_status: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime + :vartype post_update_reboot_status: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime """ _attribute_map = { - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'agent_update_status': {'key': 'agentUpdateStatus', 'type': 'str'}, - 'post_update_reboot_status': {'key': 'postUpdateRebootStatus', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, + "agent_version": {"key": "agentVersion", "type": "str"}, + "agent_update_status": {"key": "agentUpdateStatus", "type": "str"}, + "post_update_reboot_status": {"key": "postUpdateRebootStatus", "type": "str"}, + "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, } def __init__( @@ -8542,7 +10734,18 @@ def __init__( agent_expiry_date: Optional[datetime.datetime] = None, **kwargs ): - super(InMageAgentDetails, self).__init__(**kwargs) + """ + :keyword agent_version: The agent version. + :paramtype agent_version: str + :keyword agent_update_status: A value indicating whether installed agent needs to be updated. + :paramtype agent_update_status: str + :keyword post_update_reboot_status: A value indicating whether reboot is required after update + is applied. + :paramtype post_update_reboot_status: str + :keyword agent_expiry_date: Agent expiry date. + :paramtype agent_expiry_date: ~datetime.datetime + """ + super().__init__(**kwargs) self.agent_version = agent_version self.agent_update_status = agent_update_status self.post_update_reboot_status = post_update_reboot_status @@ -8554,45 +10757,43 @@ class InMageAzureV2ApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInp All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(InMageAzureV2ApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str -class InMageAzureV2DiskInputDetails(msrest.serialization.Model): +class InMageAzureV2DiskInputDetails(_serialization.Model): """Disk input details. - :param disk_id: The DiskId. - :type disk_id: str - :param log_storage_account_id: The LogStorageAccountId. - :type log_storage_account_id: str - :param disk_type: The DiskType. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar disk_id: The DiskId. + :vartype disk_id: str + :ivar log_storage_account_id: The LogStorageAccountId. + :vartype log_storage_account_id: str + :ivar disk_type: The DiskType. Known values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :type disk_encryption_set_id: str + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :vartype disk_encryption_set_id: str """ _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, } def __init__( @@ -8600,122 +10801,135 @@ def __init__( *, disk_id: Optional[str] = None, log_storage_account_id: Optional[str] = None, - disk_type: Optional[Union[str, "DiskAccountType"]] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, disk_encryption_set_id: Optional[str] = None, **kwargs ): - super(InMageAzureV2DiskInputDetails, self).__init__(**kwargs) + """ + :keyword disk_id: The DiskId. + :paramtype disk_id: str + :keyword log_storage_account_id: The LogStorageAccountId. + :paramtype log_storage_account_id: str + :keyword disk_type: The DiskType. Known values are: "Standard_LRS", "Premium_LRS", and + "StandardSSD_LRS". + :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :keyword disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :paramtype disk_encryption_set_id: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.log_storage_account_id = log_storage_account_id self.disk_type = disk_type self.disk_encryption_set_id = disk_encryption_set_id -class InMageAzureV2EnableProtectionInput(EnableProtectionProviderSpecificInput): +class InMageAzureV2EnableProtectionInput( + EnableProtectionProviderSpecificInput +): # pylint: disable=too-many-instance-attributes """VMware Azure specific enable protection input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param master_target_id: The Master target Id. - :type master_target_id: str - :param process_server_id: The Process Server Id. - :type process_server_id: str - :param storage_account_id: The storage account Id. - :type storage_account_id: str - :param run_as_account_id: The CS account Id. - :type run_as_account_id: str - :param multi_vm_group_id: The multi VM group Id. - :type multi_vm_group_id: str - :param multi_vm_group_name: The multi VM group name. - :type multi_vm_group_name: str - :param disks_to_include: The disks to include list. - :type disks_to_include: + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar master_target_id: The Master target Id. + :vartype master_target_id: str + :ivar process_server_id: The Process Server Id. + :vartype process_server_id: str + :ivar storage_account_id: The storage account Id. + :vartype storage_account_id: str + :ivar run_as_account_id: The CS account Id. + :vartype run_as_account_id: str + :ivar multi_vm_group_id: The multi VM group Id. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi VM group name. + :vartype multi_vm_group_name: str + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2DiskInputDetails] - :param target_azure_network_id: The selected target Azure network Id. - :type target_azure_network_id: str - :param target_azure_subnet_id: The selected target Azure subnet Id. - :type target_azure_subnet_id: str - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target VM after + :ivar target_azure_network_id: The selected target Azure network Id. + :vartype target_azure_network_id: str + :ivar target_azure_subnet_id: The selected target Azure subnet Id. + :vartype target_azure_subnet_id: str + :ivar enable_rdp_on_target_option: The selected option to enable RDP\SSH on target VM after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param target_azure_vm_name: The target azure VM Name. - :type target_azure_vm_name: str - :param log_storage_account_id: The storage account to be used for logging during replication. - :type log_storage_account_id: str - :param target_azure_v1_resource_group_id: The Id of the target resource group (for classic + :vartype enable_rdp_on_target_option: str + :ivar target_azure_vm_name: The target azure VM Name. + :vartype target_azure_vm_name: str + :ivar log_storage_account_id: The storage account to be used for logging during replication. + :vartype log_storage_account_id: str + :ivar target_azure_v1_resource_group_id: The Id of the target resource group (for classic deployment) in which the failover VM is to be created. - :type target_azure_v1_resource_group_id: str - :param target_azure_v2_resource_group_id: The Id of the target resource group (for resource + :vartype target_azure_v1_resource_group_id: str + :ivar target_azure_v2_resource_group_id: The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created. - :type target_azure_v2_resource_group_id: str - :param disk_type: The DiskType. Possible values include: "Standard_LRS", "Premium_LRS", + :vartype target_azure_v2_resource_group_id: str + :ivar disk_type: The DiskType. Known values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param target_availability_set_id: The target availability set ARM Id for resource manager + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar target_availability_set_id: The target availability set ARM Id for resource manager deployment. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The proximity placement group ARM Id. - :type target_proximity_placement_group_id: str - :param license_type: License type. Possible values include: "NotSpecified", "NoLicenseType", + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The proximity placement group ARM Id. + :vartype target_proximity_placement_group_id: str + :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_managed_disk_tags: The tags for the seed managed disks. - :type seed_managed_disk_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[InMageAzureV2DiskInputDetails]'}, - 'target_azure_network_id': {'key': 'targetAzureNetworkId', 'type': 'str'}, - 'target_azure_subnet_id': {'key': 'targetAzureSubnetId', 'type': 'str'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'target_azure_vm_name': {'key': 'targetAzureVmName', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'target_azure_v1_resource_group_id': {'key': 'targetAzureV1ResourceGroupId', 'type': 'str'}, - 'target_azure_v2_resource_group_id': {'key': 'targetAzureV2ResourceGroupId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_managed_disk_tags': {'key': 'seedManagedDiskTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - } - - def __init__( + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "master_target_id": {"key": "masterTargetId", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, + "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "disks_to_include": {"key": "disksToInclude", "type": "[InMageAzureV2DiskInputDetails]"}, + "target_azure_network_id": {"key": "targetAzureNetworkId", "type": "str"}, + "target_azure_subnet_id": {"key": "targetAzureSubnetId", "type": "str"}, + "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, + "target_azure_vm_name": {"key": "targetAzureVmName", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "target_azure_v1_resource_group_id": {"key": "targetAzureV1ResourceGroupId", "type": "str"}, + "target_azure_v2_resource_group_id": {"key": "targetAzureV2ResourceGroupId", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, + "target_vm_size": {"key": "targetVmSize", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, + "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, + "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "{str}"}, + "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, + "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, master_target_id: Optional[str] = None, @@ -8724,7 +10938,7 @@ def __init__( run_as_account_id: Optional[str] = None, multi_vm_group_id: Optional[str] = None, multi_vm_group_name: Optional[str] = None, - disks_to_include: Optional[List["InMageAzureV2DiskInputDetails"]] = None, + disks_to_include: Optional[List["_models.InMageAzureV2DiskInputDetails"]] = None, target_azure_network_id: Optional[str] = None, target_azure_subnet_id: Optional[str] = None, enable_rdp_on_target_option: Optional[str] = None, @@ -8732,12 +10946,12 @@ def __init__( log_storage_account_id: Optional[str] = None, target_azure_v1_resource_group_id: Optional[str] = None, target_azure_v2_resource_group_id: Optional[str] = None, - disk_type: Optional[Union[str, "DiskAccountType"]] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, target_availability_set_id: Optional[str] = None, target_availability_zone: Optional[str] = None, target_proximity_placement_group_id: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, - sql_server_license_type: Optional[Union[str, "SqlServerLicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, target_vm_size: Optional[str] = None, disk_encryption_set_id: Optional[str] = None, target_vm_tags: Optional[Dict[str, str]] = None, @@ -8746,8 +10960,71 @@ def __init__( target_nic_tags: Optional[Dict[str, str]] = None, **kwargs ): - super(InMageAzureV2EnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + """ + :keyword master_target_id: The Master target Id. + :paramtype master_target_id: str + :keyword process_server_id: The Process Server Id. + :paramtype process_server_id: str + :keyword storage_account_id: The storage account Id. + :paramtype storage_account_id: str + :keyword run_as_account_id: The CS account Id. + :paramtype run_as_account_id: str + :keyword multi_vm_group_id: The multi VM group Id. + :paramtype multi_vm_group_id: str + :keyword multi_vm_group_name: The multi VM group name. + :paramtype multi_vm_group_name: str + :keyword disks_to_include: The disks to include list. + :paramtype disks_to_include: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2DiskInputDetails] + :keyword target_azure_network_id: The selected target Azure network Id. + :paramtype target_azure_network_id: str + :keyword target_azure_subnet_id: The selected target Azure subnet Id. + :paramtype target_azure_subnet_id: str + :keyword enable_rdp_on_target_option: The selected option to enable RDP\SSH on target VM after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :paramtype enable_rdp_on_target_option: str + :keyword target_azure_vm_name: The target azure VM Name. + :paramtype target_azure_vm_name: str + :keyword log_storage_account_id: The storage account to be used for logging during replication. + :paramtype log_storage_account_id: str + :keyword target_azure_v1_resource_group_id: The Id of the target resource group (for classic + deployment) in which the failover VM is to be created. + :paramtype target_azure_v1_resource_group_id: str + :keyword target_azure_v2_resource_group_id: The Id of the target resource group (for resource + manager deployment) in which the failover VM is to be created. + :paramtype target_azure_v2_resource_group_id: str + :keyword disk_type: The DiskType. Known values are: "Standard_LRS", "Premium_LRS", and + "StandardSSD_LRS". + :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :keyword target_availability_set_id: The target availability set ARM Id for resource manager + deployment. + :paramtype target_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_proximity_placement_group_id: The proximity placement group ARM Id. + :paramtype target_proximity_placement_group_id: str + :keyword license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :keyword sql_server_license_type: The SQL Server license type. Known values are: + "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". + :paramtype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :keyword target_vm_size: The target VM size. + :paramtype target_vm_size: str + :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :paramtype disk_encryption_set_id: str + :keyword target_vm_tags: The target VM tags. + :paramtype target_vm_tags: dict[str, str] + :keyword seed_managed_disk_tags: The tags for the seed managed disks. + :paramtype seed_managed_disk_tags: dict[str, str] + :keyword target_managed_disk_tags: The tags for the target managed disks. + :paramtype target_managed_disk_tags: dict[str, str] + :keyword target_nic_tags: The tags for the target NICs. + :paramtype target_nic_tags: dict[str, str] + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.master_target_id = master_target_id self.process_server_id = process_server_id self.storage_account_id = storage_account_id @@ -8781,39 +11058,38 @@ class InMageAzureV2EventDetails(EventProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param event_type: InMage Event type. Takes one of the values of + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar event_type: InMage Event type. Takes one of the values of InMageDataContract.InMageMonitoringEventType. - :type event_type: str - :param category: InMage Event Category. - :type category: str - :param component: InMage Event Component. - :type component: str - :param corrective_action: Corrective Action string for the event. - :type corrective_action: str - :param details: InMage Event Details. - :type details: str - :param summary: InMage Event Summary. - :type summary: str - :param site_name: VMware Site name. - :type site_name: str + :vartype event_type: str + :ivar category: InMage Event Category. + :vartype category: str + :ivar component: InMage Event Component. + :vartype component: str + :ivar corrective_action: Corrective Action string for the event. + :vartype corrective_action: str + :ivar details: InMage Event Details. + :vartype details: str + :ivar summary: InMage Event Summary. + :vartype summary: str + :ivar site_name: VMware Site name. + :vartype site_name: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'event_type': {'key': 'eventType', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'component': {'key': 'component', 'type': 'str'}, - 'corrective_action': {'key': 'correctiveAction', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - 'summary': {'key': 'summary', 'type': 'str'}, - 'site_name': {'key': 'siteName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "event_type": {"key": "eventType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "component": {"key": "component", "type": "str"}, + "corrective_action": {"key": "correctiveAction", "type": "str"}, + "details": {"key": "details", "type": "str"}, + "summary": {"key": "summary", "type": "str"}, + "site_name": {"key": "siteName", "type": "str"}, } def __init__( @@ -8828,8 +11104,25 @@ def __init__( site_name: Optional[str] = None, **kwargs ): - super(InMageAzureV2EventDetails, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + """ + :keyword event_type: InMage Event type. Takes one of the values of + InMageDataContract.InMageMonitoringEventType. + :paramtype event_type: str + :keyword category: InMage Event Category. + :paramtype category: str + :keyword component: InMage Event Component. + :paramtype component: str + :keyword corrective_action: Corrective Action string for the event. + :paramtype corrective_action: str + :keyword details: InMage Event Details. + :paramtype details: str + :keyword summary: InMage Event Summary. + :paramtype summary: str + :keyword site_name: VMware Site name. + :paramtype site_name: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.event_type = event_type self.category = category self.component = component @@ -8839,27 +11132,27 @@ def __init__( self.site_name = site_name -class InMageAzureV2ManagedDiskDetails(msrest.serialization.Model): +class InMageAzureV2ManagedDiskDetails(_serialization.Model): """InMageAzureV2 Managed disk details. - :param disk_id: The disk id. - :type disk_id: str - :param seed_managed_disk_id: Seed managed disk Id. - :type seed_managed_disk_id: str - :param replica_disk_type: The replica disk type. - :type replica_disk_type: str - :param disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :type disk_encryption_set_id: str - :param target_disk_name: The target disk name. - :type target_disk_name: str + :ivar disk_id: The disk id. + :vartype disk_id: str + :ivar seed_managed_disk_id: Seed managed disk Id. + :vartype seed_managed_disk_id: str + :ivar replica_disk_type: The replica disk type. + :vartype replica_disk_type: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :vartype disk_encryption_set_id: str + :ivar target_disk_name: The target disk name. + :vartype target_disk_name: str """ _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'seed_managed_disk_id': {'key': 'seedManagedDiskId', 'type': 'str'}, - 'replica_disk_type': {'key': 'replicaDiskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "seed_managed_disk_id": {"key": "seedManagedDiskId", "type": "str"}, + "replica_disk_type": {"key": "replicaDiskType", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, + "target_disk_name": {"key": "targetDiskName", "type": "str"}, } def __init__( @@ -8872,7 +11165,19 @@ def __init__( target_disk_name: Optional[str] = None, **kwargs ): - super(InMageAzureV2ManagedDiskDetails, self).__init__(**kwargs) + """ + :keyword disk_id: The disk id. + :paramtype disk_id: str + :keyword seed_managed_disk_id: Seed managed disk Id. + :paramtype seed_managed_disk_id: str + :keyword replica_disk_type: The replica disk type. + :paramtype replica_disk_type: str + :keyword disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :paramtype disk_encryption_set_id: str + :keyword target_disk_name: The target disk name. + :paramtype target_disk_name: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.seed_managed_disk_id = seed_managed_disk_id self.replica_disk_type = replica_disk_type @@ -8885,34 +11190,33 @@ class InMageAzureV2PolicyDetails(PolicyProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in minutes. - :type crash_consistent_frequency_in_minutes: int - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to + :vartype crash_consistent_frequency_in_minutes: int + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :type multi_vm_sync_status: str + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :vartype multi_vm_sync_status: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, + "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, + "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, } def __init__( @@ -8925,8 +11229,22 @@ def __init__( multi_vm_sync_status: Optional[str] = None, **kwargs ): - super(InMageAzureV2PolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + """ + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :paramtype crash_consistent_frequency_in_minutes: int + :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :paramtype recovery_point_threshold_in_minutes: int + :keyword recovery_point_history: The duration in minutes until which the recovery points need + to be stored. + :paramtype recovery_point_history: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :paramtype app_consistent_frequency_in_minutes: int + :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :paramtype multi_vm_sync_status: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes self.recovery_point_history = recovery_point_history @@ -8939,50 +11257,67 @@ class InMageAzureV2PolicyInput(PolicyProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + :vartype recovery_point_history: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: Required. A value indicating whether multi-VM sync has to be - enabled. Value should be 'Enabled' or 'Disabled'. Possible values include: "Enable", "Disable". - :type multi_vm_sync_status: str or + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value + should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :vartype multi_vm_sync_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus """ _validation = { - 'instance_type': {'required': True}, - 'multi_vm_sync_status': {'required': True}, + "instance_type": {"required": True}, + "multi_vm_sync_status": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, + "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, } def __init__( self, *, - multi_vm_sync_status: Union[str, "SetMultiVmSyncStatus"], + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], recovery_point_threshold_in_minutes: Optional[int] = None, recovery_point_history: Optional[int] = None, crash_consistent_frequency_in_minutes: Optional[int] = None, app_consistent_frequency_in_minutes: Optional[int] = None, **kwargs ): - super(InMageAzureV2PolicyInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + """ + :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :paramtype recovery_point_threshold_in_minutes: int + :keyword recovery_point_history: The duration in minutes until which the recovery points need + to be stored. + :paramtype recovery_point_history: int + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :paramtype crash_consistent_frequency_in_minutes: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in + minutes). + :paramtype app_consistent_frequency_in_minutes: int + :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + Value should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :paramtype multi_vm_sync_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes self.recovery_point_history = recovery_point_history self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes @@ -8990,78 +11325,81 @@ def __init__( self.multi_vm_sync_status = multi_vm_sync_status -class InMageAzureV2ProtectedDiskDetails(msrest.serialization.Model): +class InMageAzureV2ProtectedDiskDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """InMageAzureV2 protected disk details. - :param disk_id: The disk id. - :type disk_id: str - :param disk_name: The disk name. - :type disk_name: str - :param protection_stage: The protection stage. - :type protection_stage: str - :param health_error_code: The health error code for the disk. - :type health_error_code: str - :param rpo_in_seconds: The RPO in seconds. - :type rpo_in_seconds: long - :param resync_required: A value indicating whether resync is required for this disk. - :type resync_required: str - :param resync_progress_percentage: The resync progress percentage. - :type resync_progress_percentage: int - :param resync_duration_in_seconds: The resync duration in seconds. - :type resync_duration_in_seconds: long - :param disk_capacity_in_bytes: The disk capacity in bytes. - :type disk_capacity_in_bytes: long - :param file_system_capacity_in_bytes: The disk file system capacity in bytes. - :type file_system_capacity_in_bytes: long - :param source_data_in_mega_bytes: The source data transit in MB. - :type source_data_in_mega_bytes: float - :param ps_data_in_mega_bytes: The PS data transit in MB. - :type ps_data_in_mega_bytes: float - :param target_data_in_mega_bytes: The target data transit in MB. - :type target_data_in_mega_bytes: float - :param disk_resized: A value indicating whether disk is resized. - :type disk_resized: str - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param resync_processed_bytes: The resync processed bytes. - :type resync_processed_bytes: long - :param resync_total_transferred_bytes: The resync total transferred bytes. - :type resync_total_transferred_bytes: long - :param resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. - :type resync_last15_minutes_transferred_bytes: long - :param resync_last_data_transfer_time_utc: The last data transfer time in UTC. - :type resync_last_data_transfer_time_utc: ~datetime.datetime - :param resync_start_time: The resync start time. - :type resync_start_time: ~datetime.datetime - :param progress_health: The Progress Health. - :type progress_health: str - :param progress_status: The Progress Status. - :type progress_status: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'protection_stage': {'key': 'protectionStage', 'type': 'str'}, - 'health_error_code': {'key': 'healthErrorCode', 'type': 'str'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'resync_duration_in_seconds': {'key': 'resyncDurationInSeconds', 'type': 'long'}, - 'disk_capacity_in_bytes': {'key': 'diskCapacityInBytes', 'type': 'long'}, - 'file_system_capacity_in_bytes': {'key': 'fileSystemCapacityInBytes', 'type': 'long'}, - 'source_data_in_mega_bytes': {'key': 'sourceDataInMegaBytes', 'type': 'float'}, - 'ps_data_in_mega_bytes': {'key': 'psDataInMegaBytes', 'type': 'float'}, - 'target_data_in_mega_bytes': {'key': 'targetDataInMegaBytes', 'type': 'float'}, - 'disk_resized': {'key': 'diskResized', 'type': 'str'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'resync_processed_bytes': {'key': 'resyncProcessedBytes', 'type': 'long'}, - 'resync_total_transferred_bytes': {'key': 'resyncTotalTransferredBytes', 'type': 'long'}, - 'resync_last15_minutes_transferred_bytes': {'key': 'resyncLast15MinutesTransferredBytes', 'type': 'long'}, - 'resync_last_data_transfer_time_utc': {'key': 'resyncLastDataTransferTimeUTC', 'type': 'iso-8601'}, - 'resync_start_time': {'key': 'resyncStartTime', 'type': 'iso-8601'}, - 'progress_health': {'key': 'progressHealth', 'type': 'str'}, - 'progress_status': {'key': 'progressStatus', 'type': 'str'}, + :ivar disk_id: The disk id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar protection_stage: The protection stage. + :vartype protection_stage: str + :ivar health_error_code: The health error code for the disk. + :vartype health_error_code: str + :ivar rpo_in_seconds: The RPO in seconds. + :vartype rpo_in_seconds: int + :ivar resync_required: A value indicating whether resync is required for this disk. + :vartype resync_required: str + :ivar resync_progress_percentage: The resync progress percentage. + :vartype resync_progress_percentage: int + :ivar resync_duration_in_seconds: The resync duration in seconds. + :vartype resync_duration_in_seconds: int + :ivar disk_capacity_in_bytes: The disk capacity in bytes. + :vartype disk_capacity_in_bytes: int + :ivar file_system_capacity_in_bytes: The disk file system capacity in bytes. + :vartype file_system_capacity_in_bytes: int + :ivar source_data_in_mega_bytes: The source data transit in MB. + :vartype source_data_in_mega_bytes: float + :ivar ps_data_in_mega_bytes: The PS data transit in MB. + :vartype ps_data_in_mega_bytes: float + :ivar target_data_in_mega_bytes: The target data transit in MB. + :vartype target_data_in_mega_bytes: float + :ivar disk_resized: A value indicating whether disk is resized. + :vartype disk_resized: str + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar resync_processed_bytes: The resync processed bytes. + :vartype resync_processed_bytes: int + :ivar resync_total_transferred_bytes: The resync total transferred bytes. + :vartype resync_total_transferred_bytes: int + :ivar resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. + :vartype resync_last15_minutes_transferred_bytes: int + :ivar resync_last_data_transfer_time_utc: The last data transfer time in UTC. + :vartype resync_last_data_transfer_time_utc: ~datetime.datetime + :ivar resync_start_time: The resync start time. + :vartype resync_start_time: ~datetime.datetime + :ivar progress_health: The Progress Health. + :vartype progress_health: str + :ivar progress_status: The Progress Status. + :vartype progress_status: str + :ivar seconds_to_take_switch_provider: The seconds to take for switch provider. + :vartype seconds_to_take_switch_provider: int + """ + + _attribute_map = { + "disk_id": {"key": "diskId", "type": "str"}, + "disk_name": {"key": "diskName", "type": "str"}, + "protection_stage": {"key": "protectionStage", "type": "str"}, + "health_error_code": {"key": "healthErrorCode", "type": "str"}, + "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, + "resync_required": {"key": "resyncRequired", "type": "str"}, + "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, + "resync_duration_in_seconds": {"key": "resyncDurationInSeconds", "type": "int"}, + "disk_capacity_in_bytes": {"key": "diskCapacityInBytes", "type": "int"}, + "file_system_capacity_in_bytes": {"key": "fileSystemCapacityInBytes", "type": "int"}, + "source_data_in_mega_bytes": {"key": "sourceDataInMegaBytes", "type": "float"}, + "ps_data_in_mega_bytes": {"key": "psDataInMegaBytes", "type": "float"}, + "target_data_in_mega_bytes": {"key": "targetDataInMegaBytes", "type": "float"}, + "disk_resized": {"key": "diskResized", "type": "str"}, + "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, + "resync_processed_bytes": {"key": "resyncProcessedBytes", "type": "int"}, + "resync_total_transferred_bytes": {"key": "resyncTotalTransferredBytes", "type": "int"}, + "resync_last15_minutes_transferred_bytes": {"key": "resyncLast15MinutesTransferredBytes", "type": "int"}, + "resync_last_data_transfer_time_utc": {"key": "resyncLastDataTransferTimeUTC", "type": "iso-8601"}, + "resync_start_time": {"key": "resyncStartTime", "type": "iso-8601"}, + "progress_health": {"key": "progressHealth", "type": "str"}, + "progress_status": {"key": "progressStatus", "type": "str"}, + "seconds_to_take_switch_provider": {"key": "secondsToTakeSwitchProvider", "type": "int"}, } def __init__( @@ -9089,9 +11427,58 @@ def __init__( resync_start_time: Optional[datetime.datetime] = None, progress_health: Optional[str] = None, progress_status: Optional[str] = None, - **kwargs - ): - super(InMageAzureV2ProtectedDiskDetails, self).__init__(**kwargs) + seconds_to_take_switch_provider: Optional[int] = None, + **kwargs + ): + """ + :keyword disk_id: The disk id. + :paramtype disk_id: str + :keyword disk_name: The disk name. + :paramtype disk_name: str + :keyword protection_stage: The protection stage. + :paramtype protection_stage: str + :keyword health_error_code: The health error code for the disk. + :paramtype health_error_code: str + :keyword rpo_in_seconds: The RPO in seconds. + :paramtype rpo_in_seconds: int + :keyword resync_required: A value indicating whether resync is required for this disk. + :paramtype resync_required: str + :keyword resync_progress_percentage: The resync progress percentage. + :paramtype resync_progress_percentage: int + :keyword resync_duration_in_seconds: The resync duration in seconds. + :paramtype resync_duration_in_seconds: int + :keyword disk_capacity_in_bytes: The disk capacity in bytes. + :paramtype disk_capacity_in_bytes: int + :keyword file_system_capacity_in_bytes: The disk file system capacity in bytes. + :paramtype file_system_capacity_in_bytes: int + :keyword source_data_in_mega_bytes: The source data transit in MB. + :paramtype source_data_in_mega_bytes: float + :keyword ps_data_in_mega_bytes: The PS data transit in MB. + :paramtype ps_data_in_mega_bytes: float + :keyword target_data_in_mega_bytes: The target data transit in MB. + :paramtype target_data_in_mega_bytes: float + :keyword disk_resized: A value indicating whether disk is resized. + :paramtype disk_resized: str + :keyword last_rpo_calculated_time: The last RPO calculated time. + :paramtype last_rpo_calculated_time: ~datetime.datetime + :keyword resync_processed_bytes: The resync processed bytes. + :paramtype resync_processed_bytes: int + :keyword resync_total_transferred_bytes: The resync total transferred bytes. + :paramtype resync_total_transferred_bytes: int + :keyword resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. + :paramtype resync_last15_minutes_transferred_bytes: int + :keyword resync_last_data_transfer_time_utc: The last data transfer time in UTC. + :paramtype resync_last_data_transfer_time_utc: ~datetime.datetime + :keyword resync_start_time: The resync start time. + :paramtype resync_start_time: ~datetime.datetime + :keyword progress_health: The Progress Health. + :paramtype progress_health: str + :keyword progress_status: The Progress Status. + :paramtype progress_status: str + :keyword seconds_to_take_switch_provider: The seconds to take for switch provider. + :paramtype seconds_to_take_switch_provider: int + """ + super().__init__(**kwargs) self.disk_id = disk_id self.disk_name = disk_name self.protection_stage = protection_stage @@ -9114,6 +11501,7 @@ def __init__( self.resync_start_time = resync_start_time self.progress_health = progress_health self.progress_status = progress_status + self.seconds_to_take_switch_provider = seconds_to_take_switch_provider class InMageAzureV2RecoveryPointDetails(ProviderSpecificRecoveryPointDetails): @@ -9121,264 +11509,276 @@ class InMageAzureV2RecoveryPointDetails(ProviderSpecificRecoveryPointDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the provider type.Constant filled by server. - :type instance_type: str - :param is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM + :ivar instance_type: Gets the provider type. Required. + :vartype instance_type: str + :ivar is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM consistent. - :type is_multi_vm_sync_point: str + :vartype is_multi_vm_sync_point: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'is_multi_vm_sync_point': {'key': 'isMultiVmSyncPoint', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "is_multi_vm_sync_point": {"key": "isMultiVmSyncPoint", "type": "str"}, } - def __init__( - self, - *, - is_multi_vm_sync_point: Optional[str] = None, - **kwargs - ): - super(InMageAzureV2RecoveryPointDetails, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + def __init__(self, *, is_multi_vm_sync_point: Optional[str] = None, **kwargs): + """ + :keyword is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM + consistent. + :paramtype is_multi_vm_sync_point: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.is_multi_vm_sync_point = is_multi_vm_sync_point -class InMageAzureV2ReplicationDetails(ReplicationProviderSpecificSettings): +class InMageAzureV2ReplicationDetails( + ReplicationProviderSpecificSettings +): # pylint: disable=too-many-instance-attributes """InMageAzureV2 provider specific settings. 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. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param infrastructure_vm_id: The infrastructure VM Id. - :type infrastructure_vm_id: str - :param v_center_infrastructure_id: The vCenter infrastructure Id. - :type v_center_infrastructure_id: str - :param protection_stage: The protection stage. - :type protection_stage: str - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param resync_progress_percentage: The resync progress percentage. - :type resync_progress_percentage: int - :param rpo_in_seconds: The RPO in seconds. - :type rpo_in_seconds: long - :param compressed_data_rate_in_mb: The compressed data change rate in MB. - :type compressed_data_rate_in_mb: float - :param uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. - :type uncompressed_data_rate_in_mb: float - :param ip_address: The source IP address. - :type ip_address: str - :param agent_version: The agent version. - :type agent_version: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param is_agent_update_required: A value indicating whether installed agent needs to be - updated. - :type is_agent_update_required: str - :param is_reboot_after_update_required: A value indicating whether the source server requires a + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar infrastructure_vm_id: The infrastructure VM Id. + :vartype infrastructure_vm_id: str + :ivar v_center_infrastructure_id: The vCenter infrastructure Id. + :vartype v_center_infrastructure_id: str + :ivar protection_stage: The protection stage. + :vartype protection_stage: str + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar resync_progress_percentage: The resync progress percentage. + :vartype resync_progress_percentage: int + :ivar rpo_in_seconds: The RPO in seconds. + :vartype rpo_in_seconds: int + :ivar compressed_data_rate_in_mb: The compressed data change rate in MB. + :vartype compressed_data_rate_in_mb: float + :ivar uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. + :vartype uncompressed_data_rate_in_mb: float + :ivar ip_address: The source IP address. + :vartype ip_address: str + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar is_agent_update_required: A value indicating whether installed agent needs to be updated. + :vartype is_agent_update_required: str + :ivar is_reboot_after_update_required: A value indicating whether the source server requires a restart after update. - :type is_reboot_after_update_required: str - :param last_heartbeat: The last heartbeat received from the source server. - :type last_heartbeat: ~datetime.datetime - :param process_server_id: The process server Id. - :type process_server_id: str - :param process_server_name: The process server name. - :type process_server_name: str - :param multi_vm_group_id: The multi vm group Id. - :type multi_vm_group_id: str - :param multi_vm_group_name: The multi vm group name. - :type multi_vm_group_name: str - :param multi_vm_sync_status: A value indicating whether multi vm sync is enabled or disabled. - :type multi_vm_sync_status: str - :param protected_disks: The list of protected disks. - :type protected_disks: + :vartype is_reboot_after_update_required: str + :ivar last_heartbeat: The last heartbeat received from the source server. + :vartype last_heartbeat: ~datetime.datetime + :ivar process_server_id: The process server Id. + :vartype process_server_id: str + :ivar process_server_name: The process server name. + :vartype process_server_name: str + :ivar multi_vm_group_id: The multi vm group Id. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_sync_status: A value indicating whether multi vm sync is enabled or disabled. + :vartype multi_vm_sync_status: str + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ProtectedDiskDetails] - :param disk_resized: A value indicating whether any disk is resized for this VM. - :type disk_resized: str - :param master_target_id: The master target Id. - :type master_target_id: str - :param source_vm_cpu_count: The CPU count of the VM on the primary side. - :type source_vm_cpu_count: int - :param source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :type source_vm_ram_size_in_mb: int - :param os_type: The type of the OS on the VM. - :type os_type: str - :param vhd_name: The OS disk VHD name. - :type vhd_name: str - :param os_disk_id: The id of the disk containing the OS. - :type os_disk_id: str - :param azure_vm_disk_details: Azure VM Disk details. - :type azure_vm_disk_details: + :ivar disk_resized: A value indicating whether any disk is resized for this VM. + :vartype disk_resized: str + :ivar master_target_id: The master target Id. + :vartype master_target_id: str + :ivar source_vm_cpu_count: The CPU count of the VM on the primary side. + :vartype source_vm_cpu_count: int + :ivar source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. + :vartype source_vm_ram_size_in_mb: int + :ivar os_type: The type of the OS on the VM. + :vartype os_type: str + :ivar vhd_name: The OS disk VHD name. + :vartype vhd_name: str + :ivar os_disk_id: The id of the disk containing the OS. + :vartype os_disk_id: str + :ivar azure_vm_disk_details: Azure VM Disk details. + :vartype azure_vm_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] - :param recovery_azure_vm_name: Recovery Azure given name. - :type recovery_azure_vm_name: str - :param recovery_azure_vm_size: The Recovery Azure VM size. - :type recovery_azure_vm_size: str - :param recovery_azure_storage_account: The recovery Azure storage account. - :type recovery_azure_storage_account: str - :param recovery_azure_log_storage_account_id: The ARM id of the log storage account used for + :ivar recovery_azure_vm_name: Recovery Azure given name. + :vartype recovery_azure_vm_name: str + :ivar recovery_azure_vm_size: The Recovery Azure VM size. + :vartype recovery_azure_vm_size: str + :ivar recovery_azure_storage_account: The recovery Azure storage account. + :vartype recovery_azure_storage_account: str + :ivar recovery_azure_log_storage_account_id: The ARM id of the log storage account used for replication. This will be set to null if no log storage account was provided during enable protection. - :type recovery_azure_log_storage_account_id: str - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param selected_recovery_azure_network_id: The selected recovery azure network Id. - :type selected_recovery_azure_network_id: str - :param selected_tfo_azure_network_id: The test failover virtual network. - :type selected_tfo_azure_network_id: str - :param selected_source_nic_id: The selected source nic Id which will be used as the primary nic + :vartype recovery_azure_log_storage_account_id: str + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar selected_recovery_azure_network_id: The selected recovery azure network Id. + :vartype selected_recovery_azure_network_id: str + :ivar selected_tfo_azure_network_id: The test failover virtual network. + :vartype selected_tfo_azure_network_id: str + :ivar selected_source_nic_id: The selected source nic Id which will be used as the primary nic during failover. - :type selected_source_nic_id: str - :param discovery_type: A value indicating the discovery type of the machine. Value can be + :vartype selected_source_nic_id: str + :ivar discovery_type: A value indicating the discovery type of the machine. Value can be vCenter or physical. - :type discovery_type: str - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after + :vartype discovery_type: str + :ivar enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param datastores: The datastores of the on-premise machine. Value can be list of strings that + :vartype enable_rdp_on_target_option: str + :ivar datastores: The datastores of the on-premise machine. Value can be list of strings that contain datastore names. - :type datastores: list[str] - :param target_vm_id: The ARM Id of the target Azure VM. This value will be null until the VM is + :vartype datastores: list[str] + :ivar target_vm_id: The ARM Id of the target Azure VM. This value will be null until the VM is failed over. Only after failure it will be populated with the ARM Id of the Azure VM. - :type target_vm_id: str - :param recovery_azure_resource_group_id: The target resource group Id. - :type recovery_azure_resource_group_id: str - :param recovery_availability_set_id: The recovery availability set Id. - :type recovery_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during + :vartype target_vm_id: str + :ivar recovery_azure_resource_group_id: The target resource group Id. + :vartype recovery_azure_resource_group_id: str + :ivar recovery_availability_set_id: The recovery availability set Id. + :vartype recovery_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during failover. - :type use_managed_disks: str - :param license_type: License Type of the VM to be used. - :type license_type: str - :param sql_server_license_type: The SQL Server license type. - :type sql_server_license_type: str - :param validation_errors: The validation errors of the on-premise machine Value can be list of + :vartype use_managed_disks: str + :ivar license_type: License Type of the VM to be used. + :vartype license_type: str + :ivar sql_server_license_type: The SQL Server license type. + :vartype sql_server_license_type: str + :ivar validation_errors: The validation errors of the on-premise machine Value can be list of validation errors. - :type validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param last_update_received_time: The last update time received from on-prem components. - :type last_update_received_time: ~datetime.datetime - :param replica_id: The replica id of the protected item. - :type replica_id: str - :param os_version: The OS Version of the protected item. - :type os_version: str - :param protected_managed_disks: The list of protected managed disks. - :type protected_managed_disks: + :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar last_update_received_time: The last update time received from on-prem components. + :vartype last_update_received_time: ~datetime.datetime + :ivar replica_id: The replica id of the protected item. + :vartype replica_id: str + :ivar os_version: The OS Version of the protected item. + :vartype os_version: str + :ivar protected_managed_disks: The list of protected managed disks. + :vartype protected_managed_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ManagedDiskDetails] :ivar last_recovery_point_received: The last recovery point received time. :vartype last_recovery_point_received: ~datetime.datetime - :param firmware_type: The firmware type of this protected item. - :type firmware_type: str - :param azure_vm_generation: The target generation for this protected item. - :type azure_vm_generation: str - :param is_additional_stats_available: A value indicating whether additional IR stats are + :ivar firmware_type: The firmware type of this protected item. + :vartype firmware_type: str + :ivar azure_vm_generation: The target generation for this protected item. + :vartype azure_vm_generation: str + :ivar is_additional_stats_available: A value indicating whether additional IR stats are available or not. - :type is_additional_stats_available: bool - :param total_data_transferred: The total transferred data in bytes. - :type total_data_transferred: long - :param total_progress_health: The progress health. - :type total_progress_health: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_managed_disk_tags: The tags for the seed managed disks. - :type seed_managed_disk_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - 'last_recovery_point_received': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'infrastructure_vm_id': {'key': 'infrastructureVmId', 'type': 'str'}, - 'v_center_infrastructure_id': {'key': 'vCenterInfrastructureId', 'type': 'str'}, - 'protection_stage': {'key': 'protectionStage', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'compressed_data_rate_in_mb': {'key': 'compressedDataRateInMB', 'type': 'float'}, - 'uncompressed_data_rate_in_mb': {'key': 'uncompressedDataRateInMB', 'type': 'float'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'is_agent_update_required': {'key': 'isAgentUpdateRequired', 'type': 'str'}, - 'is_reboot_after_update_required': {'key': 'isRebootAfterUpdateRequired', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'process_server_name': {'key': 'processServerName', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[InMageAzureV2ProtectedDiskDetails]'}, - 'disk_resized': {'key': 'diskResized', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'source_vm_cpu_count': {'key': 'sourceVmCpuCount', 'type': 'int'}, - 'source_vm_ram_size_in_mb': {'key': 'sourceVmRamSizeInMB', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vhd_name': {'key': 'vhdName', 'type': 'str'}, - 'os_disk_id': {'key': 'osDiskId', 'type': 'str'}, - 'azure_vm_disk_details': {'key': 'azureVMDiskDetails', 'type': '[AzureVmDiskDetails]'}, - 'recovery_azure_vm_name': {'key': 'recoveryAzureVMName', 'type': 'str'}, - 'recovery_azure_vm_size': {'key': 'recoveryAzureVMSize', 'type': 'str'}, - 'recovery_azure_storage_account': {'key': 'recoveryAzureStorageAccount', 'type': 'str'}, - 'recovery_azure_log_storage_account_id': {'key': 'recoveryAzureLogStorageAccountId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'selected_recovery_azure_network_id': {'key': 'selectedRecoveryAzureNetworkId', 'type': 'str'}, - 'selected_tfo_azure_network_id': {'key': 'selectedTfoAzureNetworkId', 'type': 'str'}, - 'selected_source_nic_id': {'key': 'selectedSourceNicId', 'type': 'str'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'datastores': {'key': 'datastores', 'type': '[str]'}, - 'target_vm_id': {'key': 'targetVmId', 'type': 'str'}, - 'recovery_azure_resource_group_id': {'key': 'recoveryAzureResourceGroupId', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'validation_errors': {'key': 'validationErrors', 'type': '[HealthError]'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'last_update_received_time': {'key': 'lastUpdateReceivedTime', 'type': 'iso-8601'}, - 'replica_id': {'key': 'replicaId', 'type': 'str'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'protected_managed_disks': {'key': 'protectedManagedDisks', 'type': '[InMageAzureV2ManagedDiskDetails]'}, - 'last_recovery_point_received': {'key': 'lastRecoveryPointReceived', 'type': 'iso-8601'}, - 'firmware_type': {'key': 'firmwareType', 'type': 'str'}, - 'azure_vm_generation': {'key': 'azureVmGeneration', 'type': 'str'}, - 'is_additional_stats_available': {'key': 'isAdditionalStatsAvailable', 'type': 'bool'}, - 'total_data_transferred': {'key': 'totalDataTransferred', 'type': 'long'}, - 'total_progress_health': {'key': 'totalProgressHealth', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_managed_disk_tags': {'key': 'seedManagedDiskTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - } - - def __init__( + :vartype is_additional_stats_available: bool + :ivar total_data_transferred: The total transferred data in bytes. + :vartype total_data_transferred: int + :ivar total_progress_health: The progress health. + :vartype total_progress_health: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar switch_provider_blocking_error_details: The switch provider blocking error information. + :vartype switch_provider_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderBlockingErrorDetails] + :ivar switch_provider_details: The switch provider blocking error information. + :vartype switch_provider_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderDetails + """ + + _validation = { + "instance_type": {"required": True}, + "last_recovery_point_received": {"readonly": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "infrastructure_vm_id": {"key": "infrastructureVmId", "type": "str"}, + "v_center_infrastructure_id": {"key": "vCenterInfrastructureId", "type": "str"}, + "protection_stage": {"key": "protectionStage", "type": "str"}, + "vm_id": {"key": "vmId", "type": "str"}, + "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, + "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, + "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, + "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, + "compressed_data_rate_in_mb": {"key": "compressedDataRateInMB", "type": "float"}, + "uncompressed_data_rate_in_mb": {"key": "uncompressedDataRateInMB", "type": "float"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "agent_version": {"key": "agentVersion", "type": "str"}, + "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, + "is_agent_update_required": {"key": "isAgentUpdateRequired", "type": "str"}, + "is_reboot_after_update_required": {"key": "isRebootAfterUpdateRequired", "type": "str"}, + "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "process_server_name": {"key": "processServerName", "type": "str"}, + "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, + "protected_disks": {"key": "protectedDisks", "type": "[InMageAzureV2ProtectedDiskDetails]"}, + "disk_resized": {"key": "diskResized", "type": "str"}, + "master_target_id": {"key": "masterTargetId", "type": "str"}, + "source_vm_cpu_count": {"key": "sourceVmCpuCount", "type": "int"}, + "source_vm_ram_size_in_mb": {"key": "sourceVmRamSizeInMB", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "vhd_name": {"key": "vhdName", "type": "str"}, + "os_disk_id": {"key": "osDiskId", "type": "str"}, + "azure_vm_disk_details": {"key": "azureVMDiskDetails", "type": "[AzureVmDiskDetails]"}, + "recovery_azure_vm_name": {"key": "recoveryAzureVMName", "type": "str"}, + "recovery_azure_vm_size": {"key": "recoveryAzureVMSize", "type": "str"}, + "recovery_azure_storage_account": {"key": "recoveryAzureStorageAccount", "type": "str"}, + "recovery_azure_log_storage_account_id": {"key": "recoveryAzureLogStorageAccountId", "type": "str"}, + "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, + "selected_recovery_azure_network_id": {"key": "selectedRecoveryAzureNetworkId", "type": "str"}, + "selected_tfo_azure_network_id": {"key": "selectedTfoAzureNetworkId", "type": "str"}, + "selected_source_nic_id": {"key": "selectedSourceNicId", "type": "str"}, + "discovery_type": {"key": "discoveryType", "type": "str"}, + "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, + "datastores": {"key": "datastores", "type": "[str]"}, + "target_vm_id": {"key": "targetVmId", "type": "str"}, + "recovery_azure_resource_group_id": {"key": "recoveryAzureResourceGroupId", "type": "str"}, + "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, + "validation_errors": {"key": "validationErrors", "type": "[HealthError]"}, + "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, + "last_update_received_time": {"key": "lastUpdateReceivedTime", "type": "iso-8601"}, + "replica_id": {"key": "replicaId", "type": "str"}, + "os_version": {"key": "osVersion", "type": "str"}, + "protected_managed_disks": {"key": "protectedManagedDisks", "type": "[InMageAzureV2ManagedDiskDetails]"}, + "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, + "firmware_type": {"key": "firmwareType", "type": "str"}, + "azure_vm_generation": {"key": "azureVmGeneration", "type": "str"}, + "is_additional_stats_available": {"key": "isAdditionalStatsAvailable", "type": "bool"}, + "total_data_transferred": {"key": "totalDataTransferred", "type": "int"}, + "total_progress_health": {"key": "totalProgressHealth", "type": "str"}, + "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, + "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "{str}"}, + "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, + "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, + "switch_provider_blocking_error_details": { + "key": "switchProviderBlockingErrorDetails", + "type": "[InMageAzureV2SwitchProviderBlockingErrorDetails]", + }, + "switch_provider_details": {"key": "switchProviderDetails", "type": "InMageAzureV2SwitchProviderDetails"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, infrastructure_vm_id: Optional[str] = None, @@ -9402,7 +11802,7 @@ def __init__( multi_vm_group_id: Optional[str] = None, multi_vm_group_name: Optional[str] = None, multi_vm_sync_status: Optional[str] = None, - protected_disks: Optional[List["InMageAzureV2ProtectedDiskDetails"]] = None, + protected_disks: Optional[List["_models.InMageAzureV2ProtectedDiskDetails"]] = None, disk_resized: Optional[str] = None, master_target_id: Optional[str] = None, source_vm_cpu_count: Optional[int] = None, @@ -9410,12 +11810,12 @@ def __init__( os_type: Optional[str] = None, vhd_name: Optional[str] = None, os_disk_id: Optional[str] = None, - azure_vm_disk_details: Optional[List["AzureVmDiskDetails"]] = None, + azure_vm_disk_details: Optional[List["_models.AzureVmDiskDetails"]] = None, recovery_azure_vm_name: Optional[str] = None, recovery_azure_vm_size: Optional[str] = None, recovery_azure_storage_account: Optional[str] = None, recovery_azure_log_storage_account_id: Optional[str] = None, - vm_nics: Optional[List["VMNicDetails"]] = None, + vm_nics: Optional[List["_models.VMNicDetails"]] = None, selected_recovery_azure_network_id: Optional[str] = None, selected_tfo_azure_network_id: Optional[str] = None, selected_source_nic_id: Optional[str] = None, @@ -9430,12 +11830,12 @@ def __init__( use_managed_disks: Optional[str] = None, license_type: Optional[str] = None, sql_server_license_type: Optional[str] = None, - validation_errors: Optional[List["HealthError"]] = None, + validation_errors: Optional[List["_models.HealthError"]] = None, last_rpo_calculated_time: Optional[datetime.datetime] = None, last_update_received_time: Optional[datetime.datetime] = None, replica_id: Optional[str] = None, os_version: Optional[str] = None, - protected_managed_disks: Optional[List["InMageAzureV2ManagedDiskDetails"]] = None, + protected_managed_disks: Optional[List["_models.InMageAzureV2ManagedDiskDetails"]] = None, firmware_type: Optional[str] = None, azure_vm_generation: Optional[str] = None, is_additional_stats_available: Optional[bool] = None, @@ -9445,10 +11845,166 @@ def __init__( seed_managed_disk_tags: Optional[Dict[str, str]] = None, target_managed_disk_tags: Optional[Dict[str, str]] = None, target_nic_tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(InMageAzureV2ReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + switch_provider_blocking_error_details: Optional[ + List["_models.InMageAzureV2SwitchProviderBlockingErrorDetails"] + ] = None, + switch_provider_details: Optional["_models.InMageAzureV2SwitchProviderDetails"] = None, + **kwargs + ): + """ + :keyword infrastructure_vm_id: The infrastructure VM Id. + :paramtype infrastructure_vm_id: str + :keyword v_center_infrastructure_id: The vCenter infrastructure Id. + :paramtype v_center_infrastructure_id: str + :keyword protection_stage: The protection stage. + :paramtype protection_stage: str + :keyword vm_id: The virtual machine Id. + :paramtype vm_id: str + :keyword vm_protection_state: The protection state for the vm. + :paramtype vm_protection_state: str + :keyword vm_protection_state_description: The protection state description for the vm. + :paramtype vm_protection_state_description: str + :keyword resync_progress_percentage: The resync progress percentage. + :paramtype resync_progress_percentage: int + :keyword rpo_in_seconds: The RPO in seconds. + :paramtype rpo_in_seconds: int + :keyword compressed_data_rate_in_mb: The compressed data change rate in MB. + :paramtype compressed_data_rate_in_mb: float + :keyword uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. + :paramtype uncompressed_data_rate_in_mb: float + :keyword ip_address: The source IP address. + :paramtype ip_address: str + :keyword agent_version: The agent version. + :paramtype agent_version: str + :keyword agent_expiry_date: Agent expiry date. + :paramtype agent_expiry_date: ~datetime.datetime + :keyword is_agent_update_required: A value indicating whether installed agent needs to be + updated. + :paramtype is_agent_update_required: str + :keyword is_reboot_after_update_required: A value indicating whether the source server requires + a restart after update. + :paramtype is_reboot_after_update_required: str + :keyword last_heartbeat: The last heartbeat received from the source server. + :paramtype last_heartbeat: ~datetime.datetime + :keyword process_server_id: The process server Id. + :paramtype process_server_id: str + :keyword process_server_name: The process server name. + :paramtype process_server_name: str + :keyword multi_vm_group_id: The multi vm group Id. + :paramtype multi_vm_group_id: str + :keyword multi_vm_group_name: The multi vm group name. + :paramtype multi_vm_group_name: str + :keyword multi_vm_sync_status: A value indicating whether multi vm sync is enabled or disabled. + :paramtype multi_vm_sync_status: str + :keyword protected_disks: The list of protected disks. + :paramtype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ProtectedDiskDetails] + :keyword disk_resized: A value indicating whether any disk is resized for this VM. + :paramtype disk_resized: str + :keyword master_target_id: The master target Id. + :paramtype master_target_id: str + :keyword source_vm_cpu_count: The CPU count of the VM on the primary side. + :paramtype source_vm_cpu_count: int + :keyword source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. + :paramtype source_vm_ram_size_in_mb: int + :keyword os_type: The type of the OS on the VM. + :paramtype os_type: str + :keyword vhd_name: The OS disk VHD name. + :paramtype vhd_name: str + :keyword os_disk_id: The id of the disk containing the OS. + :paramtype os_disk_id: str + :keyword azure_vm_disk_details: Azure VM Disk details. + :paramtype azure_vm_disk_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] + :keyword recovery_azure_vm_name: Recovery Azure given name. + :paramtype recovery_azure_vm_name: str + :keyword recovery_azure_vm_size: The Recovery Azure VM size. + :paramtype recovery_azure_vm_size: str + :keyword recovery_azure_storage_account: The recovery Azure storage account. + :paramtype recovery_azure_storage_account: str + :keyword recovery_azure_log_storage_account_id: The ARM id of the log storage account used for + replication. This will be set to null if no log storage account was provided during enable + protection. + :paramtype recovery_azure_log_storage_account_id: str + :keyword vm_nics: The PE Network details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :keyword selected_recovery_azure_network_id: The selected recovery azure network Id. + :paramtype selected_recovery_azure_network_id: str + :keyword selected_tfo_azure_network_id: The test failover virtual network. + :paramtype selected_tfo_azure_network_id: str + :keyword selected_source_nic_id: The selected source nic Id which will be used as the primary + nic during failover. + :paramtype selected_source_nic_id: str + :keyword discovery_type: A value indicating the discovery type of the machine. Value can be + vCenter or physical. + :paramtype discovery_type: str + :keyword enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :paramtype enable_rdp_on_target_option: str + :keyword datastores: The datastores of the on-premise machine. Value can be list of strings + that contain datastore names. + :paramtype datastores: list[str] + :keyword target_vm_id: The ARM Id of the target Azure VM. This value will be null until the VM + is failed over. Only after failure it will be populated with the ARM Id of the Azure VM. + :paramtype target_vm_id: str + :keyword recovery_azure_resource_group_id: The target resource group Id. + :paramtype recovery_azure_resource_group_id: str + :keyword recovery_availability_set_id: The recovery availability set Id. + :paramtype recovery_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_proximity_placement_group_id: The target proximity placement group Id. + :paramtype target_proximity_placement_group_id: str + :keyword use_managed_disks: A value indicating whether managed disks should be used during + failover. + :paramtype use_managed_disks: str + :keyword license_type: License Type of the VM to be used. + :paramtype license_type: str + :keyword sql_server_license_type: The SQL Server license type. + :paramtype sql_server_license_type: str + :keyword validation_errors: The validation errors of the on-premise machine Value can be list + of validation errors. + :paramtype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword last_rpo_calculated_time: The last RPO calculated time. + :paramtype last_rpo_calculated_time: ~datetime.datetime + :keyword last_update_received_time: The last update time received from on-prem components. + :paramtype last_update_received_time: ~datetime.datetime + :keyword replica_id: The replica id of the protected item. + :paramtype replica_id: str + :keyword os_version: The OS Version of the protected item. + :paramtype os_version: str + :keyword protected_managed_disks: The list of protected managed disks. + :paramtype protected_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ManagedDiskDetails] + :keyword firmware_type: The firmware type of this protected item. + :paramtype firmware_type: str + :keyword azure_vm_generation: The target generation for this protected item. + :paramtype azure_vm_generation: str + :keyword is_additional_stats_available: A value indicating whether additional IR stats are + available or not. + :paramtype is_additional_stats_available: bool + :keyword total_data_transferred: The total transferred data in bytes. + :paramtype total_data_transferred: int + :keyword total_progress_health: The progress health. + :paramtype total_progress_health: str + :keyword target_vm_tags: The target VM tags. + :paramtype target_vm_tags: dict[str, str] + :keyword seed_managed_disk_tags: The tags for the seed managed disks. + :paramtype seed_managed_disk_tags: dict[str, str] + :keyword target_managed_disk_tags: The tags for the target managed disks. + :paramtype target_managed_disk_tags: dict[str, str] + :keyword target_nic_tags: The tags for the target NICs. + :paramtype target_nic_tags: dict[str, str] + :keyword switch_provider_blocking_error_details: The switch provider blocking error + information. + :paramtype switch_provider_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderBlockingErrorDetails] + :keyword switch_provider_details: The switch provider blocking error information. + :paramtype switch_provider_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderDetails + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.infrastructure_vm_id = infrastructure_vm_id self.v_center_infrastructure_id = v_center_infrastructure_id self.protection_stage = protection_stage @@ -9514,6 +12070,8 @@ def __init__( self.seed_managed_disk_tags = seed_managed_disk_tags self.target_managed_disk_tags = target_managed_disk_tags self.target_nic_tags = target_nic_tags + self.switch_provider_blocking_error_details = switch_provider_blocking_error_details + self.switch_provider_details = switch_provider_details class InMageAzureV2ReprotectInput(ReverseReplicationProviderSpecificInput): @@ -9521,37 +12079,37 @@ class InMageAzureV2ReprotectInput(ReverseReplicationProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param master_target_id: The Master target Id. - :type master_target_id: str - :param process_server_id: The Process Server Id. - :type process_server_id: str - :param storage_account_id: The storage account id. - :type storage_account_id: str - :param run_as_account_id: The CS account Id. - :type run_as_account_id: str - :param policy_id: The Policy Id. - :type policy_id: str - :param log_storage_account_id: The storage account to be used for logging during replication. - :type log_storage_account_id: str - :param disks_to_include: The disks to include list. - :type disks_to_include: list[str] + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar master_target_id: The Master target Id. + :vartype master_target_id: str + :ivar process_server_id: The Process Server Id. + :vartype process_server_id: str + :ivar storage_account_id: The storage account id. + :vartype storage_account_id: str + :ivar run_as_account_id: The CS account Id. + :vartype run_as_account_id: str + :ivar policy_id: The Policy Id. + :vartype policy_id: str + :ivar log_storage_account_id: The storage account to be used for logging during replication. + :vartype log_storage_account_id: str + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: list[str] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[str]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "master_target_id": {"key": "masterTargetId", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "disks_to_include": {"key": "disksToInclude", "type": "[str]"}, } def __init__( @@ -9566,8 +12124,24 @@ def __init__( disks_to_include: Optional[List[str]] = None, **kwargs ): - super(InMageAzureV2ReprotectInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + """ + :keyword master_target_id: The Master target Id. + :paramtype master_target_id: str + :keyword process_server_id: The Process Server Id. + :paramtype process_server_id: str + :keyword storage_account_id: The storage account id. + :paramtype storage_account_id: str + :keyword run_as_account_id: The CS account Id. + :paramtype run_as_account_id: str + :keyword policy_id: The Policy Id. + :paramtype policy_id: str + :keyword log_storage_account_id: The storage account to be used for logging during replication. + :paramtype log_storage_account_id: str + :keyword disks_to_include: The disks to include list. + :paramtype disks_to_include: list[str] + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.master_target_id = master_target_id self.process_server_id = process_server_id self.storage_account_id = storage_account_id @@ -9577,35 +12151,194 @@ def __init__( self.disks_to_include = disks_to_include +class InMageAzureV2SwitchProviderBlockingErrorDetails(_serialization.Model): + """InMageAzureV2 switch provider blocking error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: The error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: The error tags. + :vartype error_tags: dict[str, str] + """ + + _validation = { + "error_code": {"readonly": True}, + "error_message": {"readonly": True}, + "possible_causes": {"readonly": True}, + "recommended_action": {"readonly": True}, + "error_message_parameters": {"readonly": True}, + "error_tags": {"readonly": True}, + } + + _attribute_map = { + "error_code": {"key": "errorCode", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, + "error_tags": {"key": "errorTags", "type": "{str}"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.error_code = None + self.error_message = None + self.possible_causes = None + self.recommended_action = None + self.error_message_parameters = None + self.error_tags = None + + +class InMageAzureV2SwitchProviderDetails(_serialization.Model): + """InMageAzureV2 switch provider details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar target_vault_id: The target vault Id. + :vartype target_vault_id: str + :ivar target_resource_id: The target resource Id. + :vartype target_resource_id: str + :ivar target_fabric_id: The target fabric Id. + :vartype target_fabric_id: str + :ivar target_appliance_id: The target appliance Id. + :vartype target_appliance_id: str + """ + + _validation = { + "target_vault_id": {"readonly": True}, + "target_resource_id": {"readonly": True}, + "target_fabric_id": {"readonly": True}, + "target_appliance_id": {"readonly": True}, + } + + _attribute_map = { + "target_vault_id": {"key": "targetVaultId", "type": "str"}, + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + "target_fabric_id": {"key": "targetFabricId", "type": "str"}, + "target_appliance_id": {"key": "targetApplianceId", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.target_vault_id = None + self.target_resource_id = None + self.target_fabric_id = None + self.target_appliance_id = None + + +class SwitchProviderSpecificInput(_serialization.Model): + """Provider specific switch provider input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InMageAzureV2SwitchProviderInput + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: The class type. Required. + :vartype instance_type: str + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + } + + _subtype_map = {"instance_type": {"InMageAzureV2": "InMageAzureV2SwitchProviderInput"}} + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = None # type: Optional[str] + + +class InMageAzureV2SwitchProviderInput(SwitchProviderSpecificInput): + """Provider specific input for InMageAzureV2 switch provider. + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar target_vault_id: The target vault Id. Required. + :vartype target_vault_id: str + :ivar target_fabric_id: The target fabric Id. Required. + :vartype target_fabric_id: str + :ivar target_appliance_id: The target appliance Id. Required. + :vartype target_appliance_id: str + """ + + _validation = { + "instance_type": {"required": True}, + "target_vault_id": {"required": True}, + "target_fabric_id": {"required": True}, + "target_appliance_id": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "target_vault_id": {"key": "targetVaultID", "type": "str"}, + "target_fabric_id": {"key": "targetFabricID", "type": "str"}, + "target_appliance_id": {"key": "targetApplianceID", "type": "str"}, + } + + def __init__(self, *, target_vault_id: str, target_fabric_id: str, target_appliance_id: str, **kwargs): + """ + :keyword target_vault_id: The target vault Id. Required. + :paramtype target_vault_id: str + :keyword target_fabric_id: The target fabric Id. Required. + :paramtype target_fabric_id: str + :keyword target_appliance_id: The target appliance Id. Required. + :paramtype target_appliance_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str + self.target_vault_id = target_vault_id + self.target_fabric_id = target_fabric_id + self.target_appliance_id = target_appliance_id + + class InMageAzureV2TestFailoverInput(TestFailoverProviderSpecificInput): """InMageAzureV2 provider specific input for test failover. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: The recovery point id to be passed to test failover to a particular + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } - def __init__( - self, - *, - recovery_point_id: Optional[str] = None, - **kwargs - ): - super(InMageAzureV2TestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + def __init__(self, *, recovery_point_id: Optional[str] = None, **kwargs): + """ + :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.recovery_point_id = recovery_point_id @@ -9614,83 +12347,85 @@ class InMageAzureV2UnplannedFailoverInput(UnplannedFailoverProviderSpecificInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } - def __init__( - self, - *, - recovery_point_id: Optional[str] = None, - **kwargs - ): - super(InMageAzureV2UnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + def __init__(self, *, recovery_point_id: Optional[str] = None, **kwargs): + """ + :keyword recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.recovery_point_id = recovery_point_id -class InMageAzureV2UpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProviderInput): +class InMageAzureV2UpdateReplicationProtectedItemInput( + UpdateReplicationProtectedItemProviderInput +): # pylint: disable=too-many-instance-attributes """InMage Azure V2 input to update replication protected item. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic deployment. - :type recovery_azure_v1_resource_group_id: str - :param recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource + :vartype recovery_azure_v1_resource_group_id: str + :ivar recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource manager deployment. - :type recovery_azure_v2_resource_group_id: str - :param use_managed_disks: A value indicating whether managed disks should be used during + :vartype recovery_azure_v2_resource_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during failover. - :type use_managed_disks: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param target_managed_disk_tags: The tags for the target managed disks. - :type target_managed_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or + :vartype use_managed_disks: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param vm_disks: The list of disk update properties. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] + :ivar vm_disks: The list of disk update properties. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_azure_v1_resource_group_id': {'key': 'recoveryAzureV1ResourceGroupId', 'type': 'str'}, - 'recovery_azure_v2_resource_group_id': {'key': 'recoveryAzureV2ResourceGroupId', 'type': 'str'}, - 'use_managed_disks': {'key': 'useManagedDisks', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'target_managed_disk_tags': {'key': 'targetManagedDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[UpdateDiskInput]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_azure_v1_resource_group_id": {"key": "recoveryAzureV1ResourceGroupId", "type": "str"}, + "recovery_azure_v2_resource_group_id": {"key": "recoveryAzureV2ResourceGroupId", "type": "str"}, + "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, + "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, + "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, + "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, + "vm_disks": {"key": "vmDisks", "type": "[UpdateDiskInput]"}, } def __init__( @@ -9704,12 +12439,39 @@ def __init__( target_vm_tags: Optional[Dict[str, str]] = None, target_managed_disk_tags: Optional[Dict[str, str]] = None, target_nic_tags: Optional[Dict[str, str]] = None, - sql_server_license_type: Optional[Union[str, "SqlServerLicenseType"]] = None, - vm_disks: Optional[List["UpdateDiskInput"]] = None, - **kwargs - ): - super(InMageAzureV2UpdateReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + vm_disks: Optional[List["_models.UpdateDiskInput"]] = None, + **kwargs + ): + """ + :keyword recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic + deployment. + :paramtype recovery_azure_v1_resource_group_id: str + :keyword recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource + manager deployment. + :paramtype recovery_azure_v2_resource_group_id: str + :keyword use_managed_disks: A value indicating whether managed disks should be used during + failover. + :paramtype use_managed_disks: str + :keyword target_proximity_placement_group_id: The target proximity placement group Id. + :paramtype target_proximity_placement_group_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_vm_tags: The target VM tags. + :paramtype target_vm_tags: dict[str, str] + :keyword target_managed_disk_tags: The tags for the target managed disks. + :paramtype target_managed_disk_tags: dict[str, str] + :keyword target_nic_tags: The tags for the target NICs. + :paramtype target_nic_tags: dict[str, str] + :keyword sql_server_license_type: The SQL Server license type. Known values are: + "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". + :paramtype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :keyword vm_disks: The list of disk update properties. + :paramtype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.recovery_azure_v1_resource_group_id = recovery_azure_v1_resource_group_id self.recovery_azure_v2_resource_group_id = recovery_azure_v2_resource_group_id self.use_managed_disks = use_managed_disks @@ -9727,30 +12489,29 @@ class InMageBasePolicyDetails(PolicyProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :type multi_vm_sync_status: str + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :vartype multi_vm_sync_status: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, + "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, } def __init__( @@ -9762,8 +12523,19 @@ def __init__( multi_vm_sync_status: Optional[str] = None, **kwargs ): - super(InMageBasePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMageBasePolicyDetails' # type: str + """ + :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :paramtype recovery_point_threshold_in_minutes: int + :keyword recovery_point_history: The duration in minutes until which the recovery points need + to be stored. + :paramtype recovery_point_history: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :paramtype app_consistent_frequency_in_minutes: int + :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :paramtype multi_vm_sync_status: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageBasePolicyDetails" # type: str self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes self.recovery_point_history = recovery_point_history self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes @@ -9775,57 +12547,57 @@ class InMageDisableProtectionProviderSpecificInput(DisableProtectionProviderSpec All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param replica_vm_deletion_status: A value indicating whether the replica VM should be - destroyed or retained. Values from Delete and Retain. - :type replica_vm_deletion_status: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar replica_vm_deletion_status: A value indicating whether the replica VM should be destroyed + or retained. Values from Delete and Retain. + :vartype replica_vm_deletion_status: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'replica_vm_deletion_status': {'key': 'replicaVmDeletionStatus', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "replica_vm_deletion_status": {"key": "replicaVmDeletionStatus", "type": "str"}, } - def __init__( - self, - *, - replica_vm_deletion_status: Optional[str] = None, - **kwargs - ): - super(InMageDisableProtectionProviderSpecificInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str + def __init__(self, *, replica_vm_deletion_status: Optional[str] = None, **kwargs): + """ + :keyword replica_vm_deletion_status: A value indicating whether the replica VM should be + destroyed or retained. Values from Delete and Retain. + :paramtype replica_vm_deletion_status: str + """ + super().__init__(**kwargs) + self.instance_type = "InMage" # type: str self.replica_vm_deletion_status = replica_vm_deletion_status -class InMageDiskDetails(msrest.serialization.Model): +class InMageDiskDetails(_serialization.Model): """VMware/Physical specific Disk Details. - :param disk_id: The disk Id. - :type disk_id: str - :param disk_name: The disk name. - :type disk_name: str - :param disk_size_in_mb: The disk size in MB. - :type disk_size_in_mb: str - :param disk_type: Whether disk is system disk or data disk. - :type disk_type: str - :param disk_configuration: Whether disk is dynamic disk or basic disk. - :type disk_configuration: str - :param volume_list: Volumes of the disk. - :type volume_list: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskVolumeDetails] + :ivar disk_id: The disk Id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar disk_size_in_mb: The disk size in MB. + :vartype disk_size_in_mb: str + :ivar disk_type: Whether disk is system disk or data disk. + :vartype disk_type: str + :ivar disk_configuration: Whether disk is dynamic disk or basic disk. + :vartype disk_configuration: str + :ivar volume_list: Volumes of the disk. + :vartype volume_list: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskVolumeDetails] """ _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'disk_size_in_mb': {'key': 'diskSizeInMB', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_configuration': {'key': 'diskConfiguration', 'type': 'str'}, - 'volume_list': {'key': 'volumeList', 'type': '[DiskVolumeDetails]'}, + "disk_id": {"key": "diskId", "type": "str"}, + "disk_name": {"key": "diskName", "type": "str"}, + "disk_size_in_mb": {"key": "diskSizeInMB", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "disk_configuration": {"key": "diskConfiguration", "type": "str"}, + "volume_list": {"key": "volumeList", "type": "[DiskVolumeDetails]"}, } def __init__( @@ -9836,10 +12608,24 @@ def __init__( disk_size_in_mb: Optional[str] = None, disk_type: Optional[str] = None, disk_configuration: Optional[str] = None, - volume_list: Optional[List["DiskVolumeDetails"]] = None, - **kwargs - ): - super(InMageDiskDetails, self).__init__(**kwargs) + volume_list: Optional[List["_models.DiskVolumeDetails"]] = None, + **kwargs + ): + """ + :keyword disk_id: The disk Id. + :paramtype disk_id: str + :keyword disk_name: The disk name. + :paramtype disk_name: str + :keyword disk_size_in_mb: The disk size in MB. + :paramtype disk_size_in_mb: str + :keyword disk_type: Whether disk is system disk or data disk. + :paramtype disk_type: str + :keyword disk_configuration: Whether disk is dynamic disk or basic disk. + :paramtype disk_configuration: str + :keyword volume_list: Volumes of the disk. + :paramtype volume_list: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskVolumeDetails] + """ + super().__init__(**kwargs) self.disk_id = disk_id self.disk_name = disk_name self.disk_size_in_mb = disk_size_in_mb @@ -9848,106 +12634,115 @@ def __init__( self.volume_list = volume_list -class InMageDiskExclusionInput(msrest.serialization.Model): +class InMageDiskExclusionInput(_serialization.Model): """DiskExclusionInput when doing enable protection of virtual machine in InMage provider. - :param volume_options: The volume label based option for disk exclusion. - :type volume_options: + :ivar volume_options: The volume label based option for disk exclusion. + :vartype volume_options: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions] - :param disk_signature_options: The guest disk signature based option for disk exclusion. - :type disk_signature_options: + :ivar disk_signature_options: The guest disk signature based option for disk exclusion. + :vartype disk_signature_options: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions] """ _attribute_map = { - 'volume_options': {'key': 'volumeOptions', 'type': '[InMageVolumeExclusionOptions]'}, - 'disk_signature_options': {'key': 'diskSignatureOptions', 'type': '[InMageDiskSignatureExclusionOptions]'}, + "volume_options": {"key": "volumeOptions", "type": "[InMageVolumeExclusionOptions]"}, + "disk_signature_options": {"key": "diskSignatureOptions", "type": "[InMageDiskSignatureExclusionOptions]"}, } def __init__( self, *, - volume_options: Optional[List["InMageVolumeExclusionOptions"]] = None, - disk_signature_options: Optional[List["InMageDiskSignatureExclusionOptions"]] = None, + volume_options: Optional[List["_models.InMageVolumeExclusionOptions"]] = None, + disk_signature_options: Optional[List["_models.InMageDiskSignatureExclusionOptions"]] = None, **kwargs ): - super(InMageDiskExclusionInput, self).__init__(**kwargs) + """ + :keyword volume_options: The volume label based option for disk exclusion. + :paramtype volume_options: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions] + :keyword disk_signature_options: The guest disk signature based option for disk exclusion. + :paramtype disk_signature_options: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions] + """ + super().__init__(**kwargs) self.volume_options = volume_options self.disk_signature_options = disk_signature_options -class InMageDiskSignatureExclusionOptions(msrest.serialization.Model): +class InMageDiskSignatureExclusionOptions(_serialization.Model): """Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. - :param disk_signature: The guest signature of disk to be excluded from replication. - :type disk_signature: str + :ivar disk_signature: The guest signature of disk to be excluded from replication. + :vartype disk_signature: str """ _attribute_map = { - 'disk_signature': {'key': 'diskSignature', 'type': 'str'}, + "disk_signature": {"key": "diskSignature", "type": "str"}, } - def __init__( - self, - *, - disk_signature: Optional[str] = None, - **kwargs - ): - super(InMageDiskSignatureExclusionOptions, self).__init__(**kwargs) + def __init__(self, *, disk_signature: Optional[str] = None, **kwargs): + """ + :keyword disk_signature: The guest signature of disk to be excluded from replication. + :paramtype disk_signature: str + """ + super().__init__(**kwargs) self.disk_signature = disk_signature -class InMageEnableProtectionInput(EnableProtectionProviderSpecificInput): +class InMageEnableProtectionInput( + EnableProtectionProviderSpecificInput +): # pylint: disable=too-many-instance-attributes """VMware Azure specific enable protection input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param vm_friendly_name: The VM Name. - :type vm_friendly_name: str - :param master_target_id: Required. The Master Target Id. - :type master_target_id: str - :param process_server_id: Required. The Process Server Id. - :type process_server_id: str - :param retention_drive: Required. The retention drive to use on the MT. - :type retention_drive: str - :param run_as_account_id: The CS account Id. - :type run_as_account_id: str - :param multi_vm_group_id: Required. The multi VM group Id. - :type multi_vm_group_id: str - :param multi_vm_group_name: Required. The multi VM group name. - :type multi_vm_group_name: str - :param datastore_name: The target datastore name. - :type datastore_name: str - :param disk_exclusion_input: The enable disk exclusion input. - :type disk_exclusion_input: + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar vm_friendly_name: The VM Name. + :vartype vm_friendly_name: str + :ivar master_target_id: The Master Target Id. Required. + :vartype master_target_id: str + :ivar process_server_id: The Process Server Id. Required. + :vartype process_server_id: str + :ivar retention_drive: The retention drive to use on the MT. Required. + :vartype retention_drive: str + :ivar run_as_account_id: The CS account Id. + :vartype run_as_account_id: str + :ivar multi_vm_group_id: The multi VM group Id. Required. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi VM group name. Required. + :vartype multi_vm_group_name: str + :ivar datastore_name: The target datastore name. + :vartype datastore_name: str + :ivar disk_exclusion_input: The enable disk exclusion input. + :vartype disk_exclusion_input: ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput - :param disks_to_include: The disks to include list. - :type disks_to_include: list[str] + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: list[str] """ _validation = { - 'instance_type': {'required': True}, - 'master_target_id': {'required': True}, - 'process_server_id': {'required': True}, - 'retention_drive': {'required': True}, - 'multi_vm_group_id': {'required': True}, - 'multi_vm_group_name': {'required': True}, + "instance_type": {"required": True}, + "master_target_id": {"required": True}, + "process_server_id": {"required": True}, + "retention_drive": {"required": True}, + "multi_vm_group_id": {"required": True}, + "multi_vm_group_name": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_friendly_name': {'key': 'vmFriendlyName', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'retention_drive': {'key': 'retentionDrive', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'datastore_name': {'key': 'datastoreName', 'type': 'str'}, - 'disk_exclusion_input': {'key': 'diskExclusionInput', 'type': 'InMageDiskExclusionInput'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[str]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "vm_friendly_name": {"key": "vmFriendlyName", "type": "str"}, + "master_target_id": {"key": "masterTargetId", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "retention_drive": {"key": "retentionDrive", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, + "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "datastore_name": {"key": "datastoreName", "type": "str"}, + "disk_exclusion_input": {"key": "diskExclusionInput", "type": "InMageDiskExclusionInput"}, + "disks_to_include": {"key": "disksToInclude", "type": "[str]"}, } def __init__( @@ -9961,12 +12756,35 @@ def __init__( vm_friendly_name: Optional[str] = None, run_as_account_id: Optional[str] = None, datastore_name: Optional[str] = None, - disk_exclusion_input: Optional["InMageDiskExclusionInput"] = None, + disk_exclusion_input: Optional["_models.InMageDiskExclusionInput"] = None, disks_to_include: Optional[List[str]] = None, **kwargs ): - super(InMageEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str + """ + :keyword vm_friendly_name: The VM Name. + :paramtype vm_friendly_name: str + :keyword master_target_id: The Master Target Id. Required. + :paramtype master_target_id: str + :keyword process_server_id: The Process Server Id. Required. + :paramtype process_server_id: str + :keyword retention_drive: The retention drive to use on the MT. Required. + :paramtype retention_drive: str + :keyword run_as_account_id: The CS account Id. + :paramtype run_as_account_id: str + :keyword multi_vm_group_id: The multi VM group Id. Required. + :paramtype multi_vm_group_id: str + :keyword multi_vm_group_name: The multi VM group name. Required. + :paramtype multi_vm_group_name: str + :keyword datastore_name: The target datastore name. + :paramtype datastore_name: str + :keyword disk_exclusion_input: The enable disk exclusion input. + :paramtype disk_exclusion_input: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput + :keyword disks_to_include: The disks to include list. + :paramtype disks_to_include: list[str] + """ + super().__init__(**kwargs) + self.instance_type = "InMage" # type: str self.vm_friendly_name = vm_friendly_name self.master_target_id = master_target_id self.process_server_id = process_server_id @@ -9979,35 +12797,82 @@ def __init__( self.disks_to_include = disks_to_include +class InMageFabricSwitchProviderBlockingErrorDetails(_serialization.Model): + """InMageFabric switch provider blocking error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: The error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: The error tags. + :vartype error_tags: dict[str, str] + """ + + _validation = { + "error_code": {"readonly": True}, + "error_message": {"readonly": True}, + "possible_causes": {"readonly": True}, + "recommended_action": {"readonly": True}, + "error_message_parameters": {"readonly": True}, + "error_tags": {"readonly": True}, + } + + _attribute_map = { + "error_code": {"key": "errorCode", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, + "error_tags": {"key": "errorTags", "type": "{str}"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.error_code = None + self.error_message = None + self.possible_causes = None + self.recommended_action = None + self.error_message_parameters = None + self.error_tags = None + + class InMagePolicyDetails(PolicyProviderSpecificDetails): """InMage specific protection profile details. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :type multi_vm_sync_status: str + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :vartype multi_vm_sync_status: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, + "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, } def __init__( @@ -10019,8 +12884,19 @@ def __init__( multi_vm_sync_status: Optional[str] = None, **kwargs ): - super(InMagePolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str + """ + :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :paramtype recovery_point_threshold_in_minutes: int + :keyword recovery_point_history: The duration in minutes until which the recovery points need + to be stored. + :paramtype recovery_point_history: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :paramtype app_consistent_frequency_in_minutes: int + :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :paramtype multi_vm_sync_status: str + """ + super().__init__(**kwargs) + self.instance_type = "InMage" # type: str self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes self.recovery_point_history = recovery_point_history self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes @@ -10032,123 +12908,137 @@ class InMagePolicyInput(PolicyProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :type recovery_point_threshold_in_minutes: int - :param recovery_point_history: The duration in minutes until which the recovery points need to + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: Required. A value indicating whether multi-VM sync has to be - enabled. Value should be 'Enabled' or 'Disabled'. Possible values include: "Enable", "Disable". - :type multi_vm_sync_status: str or + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value + should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :vartype multi_vm_sync_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus """ _validation = { - 'instance_type': {'required': True}, - 'multi_vm_sync_status': {'required': True}, + "instance_type": {"required": True}, + "multi_vm_sync_status": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_threshold_in_minutes': {'key': 'recoveryPointThresholdInMinutes', 'type': 'int'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, + "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, } def __init__( self, *, - multi_vm_sync_status: Union[str, "SetMultiVmSyncStatus"], + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], recovery_point_threshold_in_minutes: Optional[int] = None, recovery_point_history: Optional[int] = None, app_consistent_frequency_in_minutes: Optional[int] = None, **kwargs ): - super(InMagePolicyInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str + """ + :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :paramtype recovery_point_threshold_in_minutes: int + :keyword recovery_point_history: The duration in minutes until which the recovery points need + to be stored. + :paramtype recovery_point_history: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in + minutes). + :paramtype app_consistent_frequency_in_minutes: int + :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + Value should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :paramtype multi_vm_sync_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus + """ + super().__init__(**kwargs) + self.instance_type = "InMage" # type: str self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes self.recovery_point_history = recovery_point_history self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes self.multi_vm_sync_status = multi_vm_sync_status -class InMageProtectedDiskDetails(msrest.serialization.Model): +class InMageProtectedDiskDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """InMage protected disk details. - :param disk_id: The disk id. - :type disk_id: str - :param disk_name: The disk name. - :type disk_name: str - :param protection_stage: The protection stage. - :type protection_stage: str - :param health_error_code: The health error code for the disk. - :type health_error_code: str - :param rpo_in_seconds: The RPO in seconds. - :type rpo_in_seconds: long - :param resync_required: A value indicating whether resync is required for this disk. - :type resync_required: str - :param resync_progress_percentage: The resync progress percentage. - :type resync_progress_percentage: int - :param resync_duration_in_seconds: The resync duration in seconds. - :type resync_duration_in_seconds: long - :param disk_capacity_in_bytes: The disk capacity in bytes. - :type disk_capacity_in_bytes: long - :param file_system_capacity_in_bytes: The file system capacity in bytes. - :type file_system_capacity_in_bytes: long - :param source_data_in_mb: The source data transit in MB. - :type source_data_in_mb: float - :param ps_data_in_mb: The PS data transit in MB. - :type ps_data_in_mb: float - :param target_data_in_mb: The target data transit in MB. - :type target_data_in_mb: float - :param disk_resized: A value indicating whether disk is resized. - :type disk_resized: str - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param resync_processed_bytes: The resync processed bytes. - :type resync_processed_bytes: long - :param resync_total_transferred_bytes: The resync total transferred bytes. - :type resync_total_transferred_bytes: long - :param resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. - :type resync_last15_minutes_transferred_bytes: long - :param resync_last_data_transfer_time_utc: The last data transfer time in UTC. - :type resync_last_data_transfer_time_utc: ~datetime.datetime - :param resync_start_time: The resync start time. - :type resync_start_time: ~datetime.datetime - :param progress_health: The Progress Health. - :type progress_health: str - :param progress_status: The Progress Status. - :type progress_status: str - """ - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'protection_stage': {'key': 'protectionStage', 'type': 'str'}, - 'health_error_code': {'key': 'healthErrorCode', 'type': 'str'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'resync_duration_in_seconds': {'key': 'resyncDurationInSeconds', 'type': 'long'}, - 'disk_capacity_in_bytes': {'key': 'diskCapacityInBytes', 'type': 'long'}, - 'file_system_capacity_in_bytes': {'key': 'fileSystemCapacityInBytes', 'type': 'long'}, - 'source_data_in_mb': {'key': 'sourceDataInMB', 'type': 'float'}, - 'ps_data_in_mb': {'key': 'psDataInMB', 'type': 'float'}, - 'target_data_in_mb': {'key': 'targetDataInMB', 'type': 'float'}, - 'disk_resized': {'key': 'diskResized', 'type': 'str'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'resync_processed_bytes': {'key': 'resyncProcessedBytes', 'type': 'long'}, - 'resync_total_transferred_bytes': {'key': 'resyncTotalTransferredBytes', 'type': 'long'}, - 'resync_last15_minutes_transferred_bytes': {'key': 'resyncLast15MinutesTransferredBytes', 'type': 'long'}, - 'resync_last_data_transfer_time_utc': {'key': 'resyncLastDataTransferTimeUTC', 'type': 'iso-8601'}, - 'resync_start_time': {'key': 'resyncStartTime', 'type': 'iso-8601'}, - 'progress_health': {'key': 'progressHealth', 'type': 'str'}, - 'progress_status': {'key': 'progressStatus', 'type': 'str'}, + :ivar disk_id: The disk id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar protection_stage: The protection stage. + :vartype protection_stage: str + :ivar health_error_code: The health error code for the disk. + :vartype health_error_code: str + :ivar rpo_in_seconds: The RPO in seconds. + :vartype rpo_in_seconds: int + :ivar resync_required: A value indicating whether resync is required for this disk. + :vartype resync_required: str + :ivar resync_progress_percentage: The resync progress percentage. + :vartype resync_progress_percentage: int + :ivar resync_duration_in_seconds: The resync duration in seconds. + :vartype resync_duration_in_seconds: int + :ivar disk_capacity_in_bytes: The disk capacity in bytes. + :vartype disk_capacity_in_bytes: int + :ivar file_system_capacity_in_bytes: The file system capacity in bytes. + :vartype file_system_capacity_in_bytes: int + :ivar source_data_in_mb: The source data transit in MB. + :vartype source_data_in_mb: float + :ivar ps_data_in_mb: The PS data transit in MB. + :vartype ps_data_in_mb: float + :ivar target_data_in_mb: The target data transit in MB. + :vartype target_data_in_mb: float + :ivar disk_resized: A value indicating whether disk is resized. + :vartype disk_resized: str + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar resync_processed_bytes: The resync processed bytes. + :vartype resync_processed_bytes: int + :ivar resync_total_transferred_bytes: The resync total transferred bytes. + :vartype resync_total_transferred_bytes: int + :ivar resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. + :vartype resync_last15_minutes_transferred_bytes: int + :ivar resync_last_data_transfer_time_utc: The last data transfer time in UTC. + :vartype resync_last_data_transfer_time_utc: ~datetime.datetime + :ivar resync_start_time: The resync start time. + :vartype resync_start_time: ~datetime.datetime + :ivar progress_health: The Progress Health. + :vartype progress_health: str + :ivar progress_status: The Progress Status. + :vartype progress_status: str + """ + + _attribute_map = { + "disk_id": {"key": "diskId", "type": "str"}, + "disk_name": {"key": "diskName", "type": "str"}, + "protection_stage": {"key": "protectionStage", "type": "str"}, + "health_error_code": {"key": "healthErrorCode", "type": "str"}, + "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, + "resync_required": {"key": "resyncRequired", "type": "str"}, + "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, + "resync_duration_in_seconds": {"key": "resyncDurationInSeconds", "type": "int"}, + "disk_capacity_in_bytes": {"key": "diskCapacityInBytes", "type": "int"}, + "file_system_capacity_in_bytes": {"key": "fileSystemCapacityInBytes", "type": "int"}, + "source_data_in_mb": {"key": "sourceDataInMB", "type": "float"}, + "ps_data_in_mb": {"key": "psDataInMB", "type": "float"}, + "target_data_in_mb": {"key": "targetDataInMB", "type": "float"}, + "disk_resized": {"key": "diskResized", "type": "str"}, + "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, + "resync_processed_bytes": {"key": "resyncProcessedBytes", "type": "int"}, + "resync_total_transferred_bytes": {"key": "resyncTotalTransferredBytes", "type": "int"}, + "resync_last15_minutes_transferred_bytes": {"key": "resyncLast15MinutesTransferredBytes", "type": "int"}, + "resync_last_data_transfer_time_utc": {"key": "resyncLastDataTransferTimeUTC", "type": "iso-8601"}, + "resync_start_time": {"key": "resyncStartTime", "type": "iso-8601"}, + "progress_health": {"key": "progressHealth", "type": "str"}, + "progress_status": {"key": "progressStatus", "type": "str"}, } def __init__( @@ -10178,7 +13068,53 @@ def __init__( progress_status: Optional[str] = None, **kwargs ): - super(InMageProtectedDiskDetails, self).__init__(**kwargs) + """ + :keyword disk_id: The disk id. + :paramtype disk_id: str + :keyword disk_name: The disk name. + :paramtype disk_name: str + :keyword protection_stage: The protection stage. + :paramtype protection_stage: str + :keyword health_error_code: The health error code for the disk. + :paramtype health_error_code: str + :keyword rpo_in_seconds: The RPO in seconds. + :paramtype rpo_in_seconds: int + :keyword resync_required: A value indicating whether resync is required for this disk. + :paramtype resync_required: str + :keyword resync_progress_percentage: The resync progress percentage. + :paramtype resync_progress_percentage: int + :keyword resync_duration_in_seconds: The resync duration in seconds. + :paramtype resync_duration_in_seconds: int + :keyword disk_capacity_in_bytes: The disk capacity in bytes. + :paramtype disk_capacity_in_bytes: int + :keyword file_system_capacity_in_bytes: The file system capacity in bytes. + :paramtype file_system_capacity_in_bytes: int + :keyword source_data_in_mb: The source data transit in MB. + :paramtype source_data_in_mb: float + :keyword ps_data_in_mb: The PS data transit in MB. + :paramtype ps_data_in_mb: float + :keyword target_data_in_mb: The target data transit in MB. + :paramtype target_data_in_mb: float + :keyword disk_resized: A value indicating whether disk is resized. + :paramtype disk_resized: str + :keyword last_rpo_calculated_time: The last RPO calculated time. + :paramtype last_rpo_calculated_time: ~datetime.datetime + :keyword resync_processed_bytes: The resync processed bytes. + :paramtype resync_processed_bytes: int + :keyword resync_total_transferred_bytes: The resync total transferred bytes. + :paramtype resync_total_transferred_bytes: int + :keyword resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. + :paramtype resync_last15_minutes_transferred_bytes: int + :keyword resync_last_data_transfer_time_utc: The last data transfer time in UTC. + :paramtype resync_last_data_transfer_time_utc: ~datetime.datetime + :keyword resync_start_time: The resync start time. + :paramtype resync_start_time: ~datetime.datetime + :keyword progress_health: The Progress Health. + :paramtype progress_health: str + :keyword progress_status: The Progress Status. + :paramtype progress_status: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.disk_name = disk_name self.protection_stage = protection_stage @@ -10203,7 +13139,7 @@ def __init__( self.progress_status = progress_status -class InMageRcmAgentUpgradeBlockingErrorDetails(msrest.serialization.Model): +class InMageRcmAgentUpgradeBlockingErrorDetails(_serialization.Model): """InMageRcm source agent upgrade blocking error details. Variables are only populated by the server, and will be ignored when sending a request. @@ -10223,28 +13159,26 @@ class InMageRcmAgentUpgradeBlockingErrorDetails(msrest.serialization.Model): """ _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'possible_causes': {'readonly': True}, - 'recommended_action': {'readonly': True}, - 'error_message_parameters': {'readonly': True}, - 'error_tags': {'readonly': True}, + "error_code": {"readonly": True}, + "error_message": {"readonly": True}, + "possible_causes": {"readonly": True}, + "recommended_action": {"readonly": True}, + "error_message_parameters": {"readonly": True}, + "error_tags": {"readonly": True}, } _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'error_message_parameters': {'key': 'errorMessageParameters', 'type': '{str}'}, - 'error_tags': {'key': 'errorTags', 'type': '{str}'}, + "error_code": {"key": "errorCode", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, + "error_tags": {"key": "errorTags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmAgentUpgradeBlockingErrorDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error_code = None self.error_message = None self.possible_causes = None @@ -10253,39 +13187,147 @@ def __init__( self.error_tags = None +class InMageRcmApplianceDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes + """InMageRcm appliance details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The appliance Id. + :vartype id: str + :ivar name: The appliance name. + :vartype name: str + :ivar fabric_arm_id: The fabric ARM Id. + :vartype fabric_arm_id: str + :ivar process_server: The process server. + :vartype process_server: ~azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails + :ivar rcm_proxy: The of RCM proxy. + :vartype rcm_proxy: ~azure.mgmt.recoveryservicessiterecovery.models.RcmProxyDetails + :ivar push_installer: The push installer. + :vartype push_installer: ~azure.mgmt.recoveryservicessiterecovery.models.PushInstallerDetails + :ivar replication_agent: The replication agent. + :vartype replication_agent: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAgentDetails + :ivar reprotect_agent: The reprotect agent. + :vartype reprotect_agent: ~azure.mgmt.recoveryservicessiterecovery.models.ReprotectAgentDetails + :ivar mars_agent: The Mars agent. + :vartype mars_agent: ~azure.mgmt.recoveryservicessiterecovery.models.MarsAgentDetails + :ivar dra: The DRA. + :vartype dra: ~azure.mgmt.recoveryservicessiterecovery.models.DraDetails + :ivar switch_provider_blocking_error_details: The switch provider blocking error information. + :vartype switch_provider_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFabricSwitchProviderBlockingErrorDetails] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "fabric_arm_id": {"readonly": True}, + "process_server": {"readonly": True}, + "rcm_proxy": {"readonly": True}, + "push_installer": {"readonly": True}, + "replication_agent": {"readonly": True}, + "reprotect_agent": {"readonly": True}, + "mars_agent": {"readonly": True}, + "dra": {"readonly": True}, + "switch_provider_blocking_error_details": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "fabric_arm_id": {"key": "fabricArmId", "type": "str"}, + "process_server": {"key": "processServer", "type": "ProcessServerDetails"}, + "rcm_proxy": {"key": "rcmProxy", "type": "RcmProxyDetails"}, + "push_installer": {"key": "pushInstaller", "type": "PushInstallerDetails"}, + "replication_agent": {"key": "replicationAgent", "type": "ReplicationAgentDetails"}, + "reprotect_agent": {"key": "reprotectAgent", "type": "ReprotectAgentDetails"}, + "mars_agent": {"key": "marsAgent", "type": "MarsAgentDetails"}, + "dra": {"key": "dra", "type": "DraDetails"}, + "switch_provider_blocking_error_details": { + "key": "switchProviderBlockingErrorDetails", + "type": "[InMageRcmFabricSwitchProviderBlockingErrorDetails]", + }, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.fabric_arm_id = None + self.process_server = None + self.rcm_proxy = None + self.push_installer = None + self.replication_agent = None + self.reprotect_agent = None + self.mars_agent = None + self.dra = None + self.switch_provider_blocking_error_details = None + + +class InMageRcmApplianceSpecificDetails(ApplianceSpecificDetails): + """InMageRcm appliance specific details. + + 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 instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar appliances: The list of appliances. + :vartype appliances: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmApplianceDetails] + """ + + _validation = { + "instance_type": {"required": True}, + "appliances": {"readonly": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "appliances": {"key": "appliances", "type": "[InMageRcmApplianceDetails]"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str + self.appliances = None + + class InMageRcmApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): """ApplyRecoveryPoint input specific to InMageRcm provider. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: Required. The recovery point Id. - :type recovery_point_id: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_id: The recovery point Id. Required. + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, - 'recovery_point_id': {'required': True}, + "instance_type": {"required": True}, + "recovery_point_id": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } - def __init__( - self, - *, - recovery_point_id: str, - **kwargs - ): - super(InMageRcmApplyRecoveryPointInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + def __init__(self, *, recovery_point_id: str, **kwargs): + """ + :keyword recovery_point_id: The recovery point Id. Required. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.recovery_point_id = recovery_point_id -class InMageRcmDiscoveredProtectedVmDetails(msrest.serialization.Model): +class InMageRcmDiscoveredProtectedVmDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """InMageRcm discovered protected VM details. Variables are only populated by the server, and will be ignored when sending a request. @@ -10317,40 +13359,38 @@ class InMageRcmDiscoveredProtectedVmDetails(msrest.serialization.Model): """ _validation = { - 'v_center_id': {'readonly': True}, - 'v_center_fqdn': {'readonly': True}, - 'datastores': {'readonly': True}, - 'ip_addresses': {'readonly': True}, - 'vmware_tools_status': {'readonly': True}, - 'power_status': {'readonly': True}, - 'vm_fqdn': {'readonly': True}, - 'os_name': {'readonly': True}, - 'created_timestamp': {'readonly': True}, - 'updated_timestamp': {'readonly': True}, - 'is_deleted': {'readonly': True}, - 'last_discovery_time_in_utc': {'readonly': True}, + "v_center_id": {"readonly": True}, + "v_center_fqdn": {"readonly": True}, + "datastores": {"readonly": True}, + "ip_addresses": {"readonly": True}, + "vmware_tools_status": {"readonly": True}, + "power_status": {"readonly": True}, + "vm_fqdn": {"readonly": True}, + "os_name": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "is_deleted": {"readonly": True}, + "last_discovery_time_in_utc": {"readonly": True}, } _attribute_map = { - 'v_center_id': {'key': 'vCenterId', 'type': 'str'}, - 'v_center_fqdn': {'key': 'vCenterFqdn', 'type': 'str'}, - 'datastores': {'key': 'datastores', 'type': '[str]'}, - 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, - 'vmware_tools_status': {'key': 'vmwareToolsStatus', 'type': 'str'}, - 'power_status': {'key': 'powerStatus', 'type': 'str'}, - 'vm_fqdn': {'key': 'vmFqdn', 'type': 'str'}, - 'os_name': {'key': 'osName', 'type': 'str'}, - 'created_timestamp': {'key': 'createdTimestamp', 'type': 'iso-8601'}, - 'updated_timestamp': {'key': 'updatedTimestamp', 'type': 'iso-8601'}, - 'is_deleted': {'key': 'isDeleted', 'type': 'bool'}, - 'last_discovery_time_in_utc': {'key': 'lastDiscoveryTimeInUtc', 'type': 'iso-8601'}, + "v_center_id": {"key": "vCenterId", "type": "str"}, + "v_center_fqdn": {"key": "vCenterFqdn", "type": "str"}, + "datastores": {"key": "datastores", "type": "[str]"}, + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + "vmware_tools_status": {"key": "vmwareToolsStatus", "type": "str"}, + "power_status": {"key": "powerStatus", "type": "str"}, + "vm_fqdn": {"key": "vmFqdn", "type": "str"}, + "os_name": {"key": "osName", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "is_deleted": {"key": "isDeleted", "type": "bool"}, + "last_discovery_time_in_utc": {"key": "lastDiscoveryTimeInUtc", "type": "iso-8601"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmDiscoveredProtectedVmDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.v_center_id = None self.v_center_fqdn = None self.datastores = None @@ -10365,33 +13405,33 @@ def __init__( self.last_discovery_time_in_utc = None -class InMageRcmDiskInput(msrest.serialization.Model): +class InMageRcmDiskInput(_serialization.Model): """InMageRcm disk input. All required parameters must be populated in order to send to Azure. - :param disk_id: Required. The disk Id. - :type disk_id: str - :param log_storage_account_id: Required. The log storage account ARM Id. - :type log_storage_account_id: str - :param disk_type: Required. The disk type. Possible values include: "Standard_LRS", - "Premium_LRS", "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar log_storage_account_id: The log storage account ARM Id. Required. + :vartype log_storage_account_id: str + :ivar disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", and + "StandardSSD_LRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str """ _validation = { - 'disk_id': {'required': True}, - 'log_storage_account_id': {'required': True}, - 'disk_type': {'required': True}, + "disk_id": {"required": True}, + "log_storage_account_id": {"required": True}, + "disk_type": {"required": True}, } _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, } def __init__( @@ -10399,131 +13439,154 @@ def __init__( *, disk_id: str, log_storage_account_id: str, - disk_type: Union[str, "DiskAccountType"], + disk_type: Union[str, "_models.DiskAccountType"], disk_encryption_set_id: Optional[str] = None, **kwargs ): - super(InMageRcmDiskInput, self).__init__(**kwargs) + """ + :keyword disk_id: The disk Id. Required. + :paramtype disk_id: str + :keyword log_storage_account_id: The log storage account ARM Id. Required. + :paramtype log_storage_account_id: str + :keyword disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", + and "StandardSSD_LRS". + :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :paramtype disk_encryption_set_id: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.log_storage_account_id = log_storage_account_id self.disk_type = disk_type self.disk_encryption_set_id = disk_encryption_set_id -class InMageRcmDisksDefaultInput(msrest.serialization.Model): +class InMageRcmDisksDefaultInput(_serialization.Model): """InMageRcm disk input. All required parameters must be populated in order to send to Azure. - :param log_storage_account_id: Required. The log storage account ARM Id. - :type log_storage_account_id: str - :param disk_type: Required. The disk type. Possible values include: "Standard_LRS", - "Premium_LRS", "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str + :ivar log_storage_account_id: The log storage account ARM Id. Required. + :vartype log_storage_account_id: str + :ivar disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", and + "StandardSSD_LRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str """ _validation = { - 'log_storage_account_id': {'required': True}, - 'disk_type': {'required': True}, + "log_storage_account_id": {"required": True}, + "disk_type": {"required": True}, } _attribute_map = { - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, } def __init__( self, *, log_storage_account_id: str, - disk_type: Union[str, "DiskAccountType"], + disk_type: Union[str, "_models.DiskAccountType"], disk_encryption_set_id: Optional[str] = None, **kwargs ): - super(InMageRcmDisksDefaultInput, self).__init__(**kwargs) + """ + :keyword log_storage_account_id: The log storage account ARM Id. Required. + :paramtype log_storage_account_id: str + :keyword disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", + and "StandardSSD_LRS". + :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :paramtype disk_encryption_set_id: str + """ + super().__init__(**kwargs) self.log_storage_account_id = log_storage_account_id self.disk_type = disk_type self.disk_encryption_set_id = disk_encryption_set_id -class InMageRcmEnableProtectionInput(EnableProtectionProviderSpecificInput): +class InMageRcmEnableProtectionInput( + EnableProtectionProviderSpecificInput +): # pylint: disable=too-many-instance-attributes """InMageRcm specific enable protection input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param fabric_discovery_machine_id: Required. The ARM Id of discovered machine. - :type fabric_discovery_machine_id: str - :param disks_to_include: The disks to include list. - :type disks_to_include: + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar fabric_discovery_machine_id: The ARM Id of discovered machine. Required. + :vartype fabric_discovery_machine_id: str + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput] - :param disks_default: The default disk input. - :type disks_default: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput - :param target_resource_group_id: Required. The target resource group ARM Id. - :type target_resource_group_id: str - :param target_network_id: The selected target network ARM Id. - :type target_network_id: str - :param test_network_id: The selected test network ARM Id. - :type test_network_id: str - :param target_subnet_name: The selected target subnet name. - :type target_subnet_name: str - :param test_subnet_name: The selected test subnet name. - :type test_subnet_name: str - :param target_vm_name: The target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param license_type: The license type. Possible values include: "NotSpecified", - "NoLicenseType", "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param target_availability_set_id: The target availability set ARM Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + :ivar disks_default: The default disk input. + :vartype disks_default: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput + :ivar target_resource_group_id: The target resource group ARM Id. Required. + :vartype target_resource_group_id: str + :ivar target_network_id: The selected target network ARM Id. + :vartype target_network_id: str + :ivar test_network_id: The selected test network ARM Id. + :vartype test_network_id: str + :ivar target_subnet_name: The selected target subnet name. + :vartype target_subnet_name: str + :ivar test_subnet_name: The selected test subnet name. + :vartype test_subnet_name: str + :ivar target_vm_name: The target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar target_availability_set_id: The target availability set ARM Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param run_as_account_id: The run-as account Id. - :type run_as_account_id: str - :param process_server_id: Required. The process server Id. - :type process_server_id: str - :param multi_vm_group_name: The multi VM group name. - :type multi_vm_group_name: str + :vartype target_boot_diagnostics_storage_account_id: str + :ivar run_as_account_id: The run-as account Id. + :vartype run_as_account_id: str + :ivar process_server_id: The process server Id. Required. + :vartype process_server_id: str + :ivar multi_vm_group_name: The multi VM group name. + :vartype multi_vm_group_name: str """ _validation = { - 'instance_type': {'required': True}, - 'fabric_discovery_machine_id': {'required': True}, - 'target_resource_group_id': {'required': True}, - 'process_server_id': {'required': True}, + "instance_type": {"required": True}, + "fabric_discovery_machine_id": {"required": True}, + "target_resource_group_id": {"required": True}, + "process_server_id": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'fabric_discovery_machine_id': {'key': 'fabricDiscoveryMachineId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[InMageRcmDiskInput]'}, - 'disks_default': {'key': 'disksDefault', 'type': 'InMageRcmDisksDefaultInput'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'test_network_id': {'key': 'testNetworkId', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'test_subnet_name': {'key': 'testSubnetName', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "fabric_discovery_machine_id": {"key": "fabricDiscoveryMachineId", "type": "str"}, + "disks_to_include": {"key": "disksToInclude", "type": "[InMageRcmDiskInput]"}, + "disks_default": {"key": "disksDefault", "type": "InMageRcmDisksDefaultInput"}, + "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, + "target_network_id": {"key": "targetNetworkId", "type": "str"}, + "test_network_id": {"key": "testNetworkId", "type": "str"}, + "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, + "test_subnet_name": {"key": "testSubnetName", "type": "str"}, + "target_vm_name": {"key": "targetVmName", "type": "str"}, + "target_vm_size": {"key": "targetVmSize", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, } def __init__( @@ -10532,15 +13595,15 @@ def __init__( fabric_discovery_machine_id: str, target_resource_group_id: str, process_server_id: str, - disks_to_include: Optional[List["InMageRcmDiskInput"]] = None, - disks_default: Optional["InMageRcmDisksDefaultInput"] = None, + disks_to_include: Optional[List["_models.InMageRcmDiskInput"]] = None, + disks_default: Optional["_models.InMageRcmDisksDefaultInput"] = None, target_network_id: Optional[str] = None, test_network_id: Optional[str] = None, target_subnet_name: Optional[str] = None, test_subnet_name: Optional[str] = None, target_vm_name: Optional[str] = None, target_vm_size: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, target_availability_set_id: Optional[str] = None, target_availability_zone: Optional[str] = None, target_proximity_placement_group_id: Optional[str] = None, @@ -10549,8 +13612,50 @@ def __init__( multi_vm_group_name: Optional[str] = None, **kwargs ): - super(InMageRcmEnableProtectionInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + """ + :keyword fabric_discovery_machine_id: The ARM Id of discovered machine. Required. + :paramtype fabric_discovery_machine_id: str + :keyword disks_to_include: The disks to include list. + :paramtype disks_to_include: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput] + :keyword disks_default: The default disk input. + :paramtype disks_default: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput + :keyword target_resource_group_id: The target resource group ARM Id. Required. + :paramtype target_resource_group_id: str + :keyword target_network_id: The selected target network ARM Id. + :paramtype target_network_id: str + :keyword test_network_id: The selected test network ARM Id. + :paramtype test_network_id: str + :keyword target_subnet_name: The selected target subnet name. + :paramtype target_subnet_name: str + :keyword test_subnet_name: The selected test subnet name. + :paramtype test_subnet_name: str + :keyword target_vm_name: The target VM name. + :paramtype target_vm_name: str + :keyword target_vm_size: The target VM size. + :paramtype target_vm_size: str + :keyword license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :keyword target_availability_set_id: The target availability set ARM Id. + :paramtype target_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_proximity_placement_group_id: The target proximity placement group Id. + :paramtype target_proximity_placement_group_id: str + :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage + account ARM Id. + :paramtype target_boot_diagnostics_storage_account_id: str + :keyword run_as_account_id: The run-as account Id. + :paramtype run_as_account_id: str + :keyword process_server_id: The process server Id. Required. + :paramtype process_server_id: str + :keyword multi_vm_group_name: The multi VM group name. + :paramtype multi_vm_group_name: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.fabric_discovery_machine_id = fabric_discovery_machine_id self.disks_to_include = disks_to_include self.disks_default = disks_default @@ -10578,9 +13683,8 @@ class InMageRcmEventDetails(EventProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str :ivar protected_item_name: The protected item name. :vartype protected_item_name: str :ivar vm_name: The protected item name. @@ -10600,35 +13704,33 @@ class InMageRcmEventDetails(EventProviderSpecificDetails): """ _validation = { - 'instance_type': {'required': True}, - 'protected_item_name': {'readonly': True}, - 'vm_name': {'readonly': True}, - 'latest_agent_version': {'readonly': True}, - 'job_id': {'readonly': True}, - 'fabric_name': {'readonly': True}, - 'appliance_name': {'readonly': True}, - 'server_type': {'readonly': True}, - 'component_display_name': {'readonly': True}, + "instance_type": {"required": True}, + "protected_item_name": {"readonly": True}, + "vm_name": {"readonly": True}, + "latest_agent_version": {"readonly": True}, + "job_id": {"readonly": True}, + "fabric_name": {"readonly": True}, + "appliance_name": {"readonly": True}, + "server_type": {"readonly": True}, + "component_display_name": {"readonly": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'protected_item_name': {'key': 'protectedItemName', 'type': 'str'}, - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'latest_agent_version': {'key': 'latestAgentVersion', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'appliance_name': {'key': 'applianceName', 'type': 'str'}, - 'server_type': {'key': 'serverType', 'type': 'str'}, - 'component_display_name': {'key': 'componentDisplayName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "protected_item_name": {"key": "protectedItemName", "type": "str"}, + "vm_name": {"key": "vmName", "type": "str"}, + "latest_agent_version": {"key": "latestAgentVersion", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "appliance_name": {"key": "applianceName", "type": "str"}, + "server_type": {"key": "serverType", "type": "str"}, + "component_display_name": {"key": "componentDisplayName", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmEventDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.protected_item_name = None self.vm_name = None self.latest_agent_version = None @@ -10644,30 +13746,30 @@ class InMageRcmFabricCreationInput(FabricSpecificCreationInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type.Constant filled by server. - :type instance_type: str - :param vmware_site_id: Required. The ARM Id of the VMware site. - :type vmware_site_id: str - :param physical_site_id: Required. The ARM Id of the physical site. - :type physical_site_id: str - :param source_agent_identity: Required. The identity provider input for source agent - authentication. - :type source_agent_identity: + :ivar instance_type: Gets the class type. Required. + :vartype instance_type: str + :ivar vmware_site_id: The ARM Id of the VMware site. Required. + :vartype vmware_site_id: str + :ivar physical_site_id: The ARM Id of the physical site. Required. + :vartype physical_site_id: str + :ivar source_agent_identity: The identity provider input for source agent authentication. + Required. + :vartype source_agent_identity: ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput """ _validation = { - 'instance_type': {'required': True}, - 'vmware_site_id': {'required': True}, - 'physical_site_id': {'required': True}, - 'source_agent_identity': {'required': True}, + "instance_type": {"required": True}, + "vmware_site_id": {"required": True}, + "physical_site_id": {"required": True}, + "source_agent_identity": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_site_id': {'key': 'vmwareSiteId', 'type': 'str'}, - 'physical_site_id': {'key': 'physicalSiteId', 'type': 'str'}, - 'source_agent_identity': {'key': 'sourceAgentIdentity', 'type': 'IdentityProviderInput'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, + "physical_site_id": {"key": "physicalSiteId", "type": "str"}, + "source_agent_identity": {"key": "sourceAgentIdentity", "type": "IdentityProviderInput"}, } def __init__( @@ -10675,26 +13777,35 @@ def __init__( *, vmware_site_id: str, physical_site_id: str, - source_agent_identity: "IdentityProviderInput", - **kwargs - ): - super(InMageRcmFabricCreationInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + source_agent_identity: "_models.IdentityProviderInput", + **kwargs + ): + """ + :keyword vmware_site_id: The ARM Id of the VMware site. Required. + :paramtype vmware_site_id: str + :keyword physical_site_id: The ARM Id of the physical site. Required. + :paramtype physical_site_id: str + :keyword source_agent_identity: The identity provider input for source agent authentication. + Required. + :paramtype source_agent_identity: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.vmware_site_id = vmware_site_id self.physical_site_id = physical_site_id self.source_agent_identity = source_agent_identity -class InMageRcmFabricSpecificDetails(FabricSpecificDetails): +class InMageRcmFabricSpecificDetails(FabricSpecificDetails): # pylint: disable=too-many-instance-attributes """InMageRcm fabric specific details. 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. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str :ivar vmware_site_id: The ARM Id of the VMware site. :vartype vmware_site_id: str :ivar physical_site_id: The ARM Id of the physical site. @@ -10709,8 +13820,8 @@ class InMageRcmFabricSpecificDetails(FabricSpecificDetails): :vartype data_plane_uri: str :ivar control_plane_uri: The control plane Uri. :vartype control_plane_uri: str - :param source_agent_identity_details: The source agent identity details. - :type source_agent_identity_details: + :ivar source_agent_identity_details: The source agent identity details. + :vartype source_agent_identity_details: ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails :ivar process_servers: The list of process servers. :vartype process_servers: @@ -10735,52 +13846,52 @@ class InMageRcmFabricSpecificDetails(FabricSpecificDetails): """ _validation = { - 'instance_type': {'required': True}, - 'vmware_site_id': {'readonly': True}, - 'physical_site_id': {'readonly': True}, - 'service_endpoint': {'readonly': True}, - 'service_resource_id': {'readonly': True}, - 'service_container_id': {'readonly': True}, - 'data_plane_uri': {'readonly': True}, - 'control_plane_uri': {'readonly': True}, - 'process_servers': {'readonly': True}, - 'rcm_proxies': {'readonly': True}, - 'push_installers': {'readonly': True}, - 'replication_agents': {'readonly': True}, - 'reprotect_agents': {'readonly': True}, - 'mars_agents': {'readonly': True}, - 'dras': {'readonly': True}, - 'agent_details': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_site_id': {'key': 'vmwareSiteId', 'type': 'str'}, - 'physical_site_id': {'key': 'physicalSiteId', 'type': 'str'}, - 'service_endpoint': {'key': 'serviceEndpoint', 'type': 'str'}, - 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, - 'service_container_id': {'key': 'serviceContainerId', 'type': 'str'}, - 'data_plane_uri': {'key': 'dataPlaneUri', 'type': 'str'}, - 'control_plane_uri': {'key': 'controlPlaneUri', 'type': 'str'}, - 'source_agent_identity_details': {'key': 'sourceAgentIdentityDetails', 'type': 'IdentityProviderDetails'}, - 'process_servers': {'key': 'processServers', 'type': '[ProcessServerDetails]'}, - 'rcm_proxies': {'key': 'rcmProxies', 'type': '[RcmProxyDetails]'}, - 'push_installers': {'key': 'pushInstallers', 'type': '[PushInstallerDetails]'}, - 'replication_agents': {'key': 'replicationAgents', 'type': '[ReplicationAgentDetails]'}, - 'reprotect_agents': {'key': 'reprotectAgents', 'type': '[ReprotectAgentDetails]'}, - 'mars_agents': {'key': 'marsAgents', 'type': '[MarsAgentDetails]'}, - 'dras': {'key': 'dras', 'type': '[DraDetails]'}, - 'agent_details': {'key': 'agentDetails', 'type': '[AgentDetails]'}, - } - - def __init__( - self, - *, - source_agent_identity_details: Optional["IdentityProviderDetails"] = None, - **kwargs - ): - super(InMageRcmFabricSpecificDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + "instance_type": {"required": True}, + "vmware_site_id": {"readonly": True}, + "physical_site_id": {"readonly": True}, + "service_endpoint": {"readonly": True}, + "service_resource_id": {"readonly": True}, + "service_container_id": {"readonly": True}, + "data_plane_uri": {"readonly": True}, + "control_plane_uri": {"readonly": True}, + "process_servers": {"readonly": True}, + "rcm_proxies": {"readonly": True}, + "push_installers": {"readonly": True}, + "replication_agents": {"readonly": True}, + "reprotect_agents": {"readonly": True}, + "mars_agents": {"readonly": True}, + "dras": {"readonly": True}, + "agent_details": {"readonly": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, + "physical_site_id": {"key": "physicalSiteId", "type": "str"}, + "service_endpoint": {"key": "serviceEndpoint", "type": "str"}, + "service_resource_id": {"key": "serviceResourceId", "type": "str"}, + "service_container_id": {"key": "serviceContainerId", "type": "str"}, + "data_plane_uri": {"key": "dataPlaneUri", "type": "str"}, + "control_plane_uri": {"key": "controlPlaneUri", "type": "str"}, + "source_agent_identity_details": {"key": "sourceAgentIdentityDetails", "type": "IdentityProviderDetails"}, + "process_servers": {"key": "processServers", "type": "[ProcessServerDetails]"}, + "rcm_proxies": {"key": "rcmProxies", "type": "[RcmProxyDetails]"}, + "push_installers": {"key": "pushInstallers", "type": "[PushInstallerDetails]"}, + "replication_agents": {"key": "replicationAgents", "type": "[ReplicationAgentDetails]"}, + "reprotect_agents": {"key": "reprotectAgents", "type": "[ReprotectAgentDetails]"}, + "mars_agents": {"key": "marsAgents", "type": "[MarsAgentDetails]"}, + "dras": {"key": "dras", "type": "[DraDetails]"}, + "agent_details": {"key": "agentDetails", "type": "[AgentDetails]"}, + } + + def __init__(self, *, source_agent_identity_details: Optional["_models.IdentityProviderDetails"] = None, **kwargs): + """ + :keyword source_agent_identity_details: The source agent identity details. + :paramtype source_agent_identity_details: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.vmware_site_id = None self.physical_site_id = None self.service_endpoint = None @@ -10799,7 +13910,57 @@ def __init__( self.agent_details = None -class InMageRcmFailbackDiscoveredProtectedVmDetails(msrest.serialization.Model): +class InMageRcmFabricSwitchProviderBlockingErrorDetails(_serialization.Model): + """InMageRcmFabric switch provider blocking error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: The error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: The error tags. + :vartype error_tags: dict[str, str] + """ + + _validation = { + "error_code": {"readonly": True}, + "error_message": {"readonly": True}, + "possible_causes": {"readonly": True}, + "recommended_action": {"readonly": True}, + "error_message_parameters": {"readonly": True}, + "error_tags": {"readonly": True}, + } + + _attribute_map = { + "error_code": {"key": "errorCode", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, + "error_tags": {"key": "errorTags", "type": "{str}"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.error_code = None + self.error_message = None + self.possible_causes = None + self.recommended_action = None + self.error_message_parameters = None + self.error_tags = None + + +class InMageRcmFailbackDiscoveredProtectedVmDetails( + _serialization.Model +): # pylint: disable=too-many-instance-attributes """InMageRcmFailback discovered VM details. Variables are only populated by the server, and will be ignored when sending a request. @@ -10831,40 +13992,38 @@ class InMageRcmFailbackDiscoveredProtectedVmDetails(msrest.serialization.Model): """ _validation = { - 'v_center_id': {'readonly': True}, - 'v_center_fqdn': {'readonly': True}, - 'datastores': {'readonly': True}, - 'ip_addresses': {'readonly': True}, - 'vmware_tools_status': {'readonly': True}, - 'power_status': {'readonly': True}, - 'vm_fqdn': {'readonly': True}, - 'os_name': {'readonly': True}, - 'created_timestamp': {'readonly': True}, - 'updated_timestamp': {'readonly': True}, - 'is_deleted': {'readonly': True}, - 'last_discovery_time_in_utc': {'readonly': True}, + "v_center_id": {"readonly": True}, + "v_center_fqdn": {"readonly": True}, + "datastores": {"readonly": True}, + "ip_addresses": {"readonly": True}, + "vmware_tools_status": {"readonly": True}, + "power_status": {"readonly": True}, + "vm_fqdn": {"readonly": True}, + "os_name": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "is_deleted": {"readonly": True}, + "last_discovery_time_in_utc": {"readonly": True}, } _attribute_map = { - 'v_center_id': {'key': 'vCenterId', 'type': 'str'}, - 'v_center_fqdn': {'key': 'vCenterFqdn', 'type': 'str'}, - 'datastores': {'key': 'datastores', 'type': '[str]'}, - 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, - 'vmware_tools_status': {'key': 'vmwareToolsStatus', 'type': 'str'}, - 'power_status': {'key': 'powerStatus', 'type': 'str'}, - 'vm_fqdn': {'key': 'vmFqdn', 'type': 'str'}, - 'os_name': {'key': 'osName', 'type': 'str'}, - 'created_timestamp': {'key': 'createdTimestamp', 'type': 'iso-8601'}, - 'updated_timestamp': {'key': 'updatedTimestamp', 'type': 'iso-8601'}, - 'is_deleted': {'key': 'isDeleted', 'type': 'bool'}, - 'last_discovery_time_in_utc': {'key': 'lastDiscoveryTimeInUtc', 'type': 'iso-8601'}, + "v_center_id": {"key": "vCenterId", "type": "str"}, + "v_center_fqdn": {"key": "vCenterFqdn", "type": "str"}, + "datastores": {"key": "datastores", "type": "[str]"}, + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + "vmware_tools_status": {"key": "vmwareToolsStatus", "type": "str"}, + "power_status": {"key": "powerStatus", "type": "str"}, + "vm_fqdn": {"key": "vmFqdn", "type": "str"}, + "os_name": {"key": "osName", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "is_deleted": {"key": "isDeleted", "type": "bool"}, + "last_discovery_time_in_utc": {"key": "lastDiscoveryTimeInUtc", "type": "iso-8601"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackDiscoveredProtectedVmDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.v_center_id = None self.v_center_fqdn = None self.datastores = None @@ -10886,9 +14045,8 @@ class InMageRcmFailbackEventDetails(EventProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str :ivar protected_item_name: The protected item name. :vartype protected_item_name: str :ivar vm_name: The protected item name. @@ -10902,29 +14060,27 @@ class InMageRcmFailbackEventDetails(EventProviderSpecificDetails): """ _validation = { - 'instance_type': {'required': True}, - 'protected_item_name': {'readonly': True}, - 'vm_name': {'readonly': True}, - 'appliance_name': {'readonly': True}, - 'server_type': {'readonly': True}, - 'component_display_name': {'readonly': True}, + "instance_type": {"required": True}, + "protected_item_name": {"readonly": True}, + "vm_name": {"readonly": True}, + "appliance_name": {"readonly": True}, + "server_type": {"readonly": True}, + "component_display_name": {"readonly": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'protected_item_name': {'key': 'protectedItemName', 'type': 'str'}, - 'vm_name': {'key': 'vmName', 'type': 'str'}, - 'appliance_name': {'key': 'applianceName', 'type': 'str'}, - 'server_type': {'key': 'serverType', 'type': 'str'}, - 'component_display_name': {'key': 'componentDisplayName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "protected_item_name": {"key": "protectedItemName", "type": "str"}, + "vm_name": {"key": "vmName", "type": "str"}, + "appliance_name": {"key": "applianceName", "type": "str"}, + "server_type": {"key": "serverType", "type": "str"}, + "component_display_name": {"key": "componentDisplayName", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackEventDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "InMageRcmFailback" # type: str self.protected_item_name = None self.vm_name = None self.appliance_name = None @@ -10932,7 +14088,7 @@ def __init__( self.component_display_name = None -class InMageRcmFailbackMobilityAgentDetails(msrest.serialization.Model): +class InMageRcmFailbackMobilityAgentDetails(_serialization.Model): """InMageRcmFailback mobility agent details. Variables are only populated by the server, and will be ignored when sending a request. @@ -10960,34 +14116,32 @@ class InMageRcmFailbackMobilityAgentDetails(msrest.serialization.Model): """ _validation = { - 'version': {'readonly': True}, - 'latest_version': {'readonly': True}, - 'driver_version': {'readonly': True}, - 'latest_upgradable_version_without_reboot': {'readonly': True}, - 'agent_version_expiry_date': {'readonly': True}, - 'driver_version_expiry_date': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'reasons_blocking_upgrade': {'readonly': True}, - 'is_upgradeable': {'readonly': True}, + "version": {"readonly": True}, + "latest_version": {"readonly": True}, + "driver_version": {"readonly": True}, + "latest_upgradable_version_without_reboot": {"readonly": True}, + "agent_version_expiry_date": {"readonly": True}, + "driver_version_expiry_date": {"readonly": True}, + "last_heartbeat_utc": {"readonly": True}, + "reasons_blocking_upgrade": {"readonly": True}, + "is_upgradeable": {"readonly": True}, } _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'driver_version': {'key': 'driverVersion', 'type': 'str'}, - 'latest_upgradable_version_without_reboot': {'key': 'latestUpgradableVersionWithoutReboot', 'type': 'str'}, - 'agent_version_expiry_date': {'key': 'agentVersionExpiryDate', 'type': 'iso-8601'}, - 'driver_version_expiry_date': {'key': 'driverVersionExpiryDate', 'type': 'iso-8601'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'reasons_blocking_upgrade': {'key': 'reasonsBlockingUpgrade', 'type': '[str]'}, - 'is_upgradeable': {'key': 'isUpgradeable', 'type': 'str'}, + "version": {"key": "version", "type": "str"}, + "latest_version": {"key": "latestVersion", "type": "str"}, + "driver_version": {"key": "driverVersion", "type": "str"}, + "latest_upgradable_version_without_reboot": {"key": "latestUpgradableVersionWithoutReboot", "type": "str"}, + "agent_version_expiry_date": {"key": "agentVersionExpiryDate", "type": "iso-8601"}, + "driver_version_expiry_date": {"key": "driverVersionExpiryDate", "type": "iso-8601"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "reasons_blocking_upgrade": {"key": "reasonsBlockingUpgrade", "type": "[str]"}, + "is_upgradeable": {"key": "isUpgradeable", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackMobilityAgentDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.version = None self.latest_version = None self.driver_version = None @@ -10999,7 +14153,7 @@ def __init__( self.is_upgradeable = None -class InMageRcmFailbackNicDetails(msrest.serialization.Model): +class InMageRcmFailbackNicDetails(_serialization.Model): """InMageRcmFailback NIC details. Variables are only populated by the server, and will be ignored when sending a request. @@ -11015,24 +14169,22 @@ class InMageRcmFailbackNicDetails(msrest.serialization.Model): """ _validation = { - 'mac_address': {'readonly': True}, - 'network_name': {'readonly': True}, - 'adapter_type': {'readonly': True}, - 'source_ip_address': {'readonly': True}, + "mac_address": {"readonly": True}, + "network_name": {"readonly": True}, + "adapter_type": {"readonly": True}, + "source_ip_address": {"readonly": True}, } _attribute_map = { - 'mac_address': {'key': 'macAddress', 'type': 'str'}, - 'network_name': {'key': 'networkName', 'type': 'str'}, - 'adapter_type': {'key': 'adapterType', 'type': 'str'}, - 'source_ip_address': {'key': 'sourceIpAddress', 'type': 'str'}, + "mac_address": {"key": "macAddress", "type": "str"}, + "network_name": {"key": "networkName", "type": "str"}, + "adapter_type": {"key": "adapterType", "type": "str"}, + "source_ip_address": {"key": "sourceIpAddress", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackNicDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.mac_address = None self.network_name = None self.adapter_type = None @@ -11044,32 +14196,33 @@ class InMageRcmFailbackPlannedFailoverProviderInput(PlannedFailoverProviderSpeci All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "ApplicationConsistent", "CrashConsistent". - :type recovery_point_type: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_type: The recovery point type. Required. Known values are: + "ApplicationConsistent" and "CrashConsistent". + :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType """ _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, + "instance_type": {"required": True}, + "recovery_point_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, } - def __init__( - self, - *, - recovery_point_type: Union[str, "InMageRcmFailbackRecoveryPointType"], - **kwargs - ): - super(InMageRcmFailbackPlannedFailoverProviderInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str + def __init__(self, *, recovery_point_type: Union[str, "_models.InMageRcmFailbackRecoveryPointType"], **kwargs): + """ + :keyword recovery_point_type: The recovery point type. Required. Known values are: + "ApplicationConsistent" and "CrashConsistent". + :paramtype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcmFailback" # type: str self.recovery_point_type = recovery_point_type @@ -11078,23 +14231,23 @@ class InMageRcmFailbackPolicyCreationInput(PolicyProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, } def __init__( @@ -11104,8 +14257,16 @@ def __init__( app_consistent_frequency_in_minutes: Optional[int] = None, **kwargs ): - super(InMageRcmFailbackPolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str + """ + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :paramtype crash_consistent_frequency_in_minutes: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in + minutes). + :paramtype app_consistent_frequency_in_minutes: int + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcmFailback" # type: str self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes @@ -11115,24 +14276,23 @@ class InMageRcmFailbackPolicyDetails(PolicyProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in minutes. - :type crash_consistent_frequency_in_minutes: int + :vartype crash_consistent_frequency_in_minutes: int """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, } def __init__( @@ -11142,13 +14302,20 @@ def __init__( crash_consistent_frequency_in_minutes: Optional[int] = None, **kwargs ): - super(InMageRcmFailbackPolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str + """ + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :paramtype app_consistent_frequency_in_minutes: int + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :paramtype crash_consistent_frequency_in_minutes: int + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcmFailback" # type: str self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes -class InMageRcmFailbackProtectedDiskDetails(msrest.serialization.Model): +class InMageRcmFailbackProtectedDiskDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """InMageRcmFailback protected disk details. Variables are only populated by the server, and will be ignored when sending a request. @@ -11160,7 +14327,7 @@ class InMageRcmFailbackProtectedDiskDetails(msrest.serialization.Model): :ivar is_os_disk: A value indicating whether the disk is the OS disk. :vartype is_os_disk: str :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: long + :vartype capacity_in_bytes: int :ivar disk_uuid: The disk Uuid (reported by vCenter). :vartype disk_uuid: str :ivar data_pending_in_log_data_store_in_mb: The data pending in log data store in MB. @@ -11170,49 +14337,58 @@ class InMageRcmFailbackProtectedDiskDetails(msrest.serialization.Model): :ivar is_initial_replication_complete: A value indicating whether initial replication is complete or not. :vartype is_initial_replication_complete: str - :param ir_details: The initial replication details. - :type ir_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails - :param resync_details: The resync details. - :type resync_details: + :ivar ir_details: The initial replication details. + :vartype ir_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails + :ivar resync_details: The resync details. + :vartype resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails :ivar last_sync_time: The last sync time. :vartype last_sync_time: ~datetime.datetime """ _validation = { - 'disk_id': {'readonly': True}, - 'disk_name': {'readonly': True}, - 'is_os_disk': {'readonly': True}, - 'capacity_in_bytes': {'readonly': True}, - 'disk_uuid': {'readonly': True}, - 'data_pending_in_log_data_store_in_mb': {'readonly': True}, - 'data_pending_at_source_agent_in_mb': {'readonly': True}, - 'is_initial_replication_complete': {'readonly': True}, - 'last_sync_time': {'readonly': True}, + "disk_id": {"readonly": True}, + "disk_name": {"readonly": True}, + "is_os_disk": {"readonly": True}, + "capacity_in_bytes": {"readonly": True}, + "disk_uuid": {"readonly": True}, + "data_pending_in_log_data_store_in_mb": {"readonly": True}, + "data_pending_at_source_agent_in_mb": {"readonly": True}, + "is_initial_replication_complete": {"readonly": True}, + "last_sync_time": {"readonly": True}, } _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'disk_uuid': {'key': 'diskUuid', 'type': 'str'}, - 'data_pending_in_log_data_store_in_mb': {'key': 'dataPendingInLogDataStoreInMB', 'type': 'float'}, - 'data_pending_at_source_agent_in_mb': {'key': 'dataPendingAtSourceAgentInMB', 'type': 'float'}, - 'is_initial_replication_complete': {'key': 'isInitialReplicationComplete', 'type': 'str'}, - 'ir_details': {'key': 'irDetails', 'type': 'InMageRcmFailbackSyncDetails'}, - 'resync_details': {'key': 'resyncDetails', 'type': 'InMageRcmFailbackSyncDetails'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, + "disk_id": {"key": "diskId", "type": "str"}, + "disk_name": {"key": "diskName", "type": "str"}, + "is_os_disk": {"key": "isOSDisk", "type": "str"}, + "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, + "disk_uuid": {"key": "diskUuid", "type": "str"}, + "data_pending_in_log_data_store_in_mb": {"key": "dataPendingInLogDataStoreInMB", "type": "float"}, + "data_pending_at_source_agent_in_mb": {"key": "dataPendingAtSourceAgentInMB", "type": "float"}, + "is_initial_replication_complete": {"key": "isInitialReplicationComplete", "type": "str"}, + "ir_details": {"key": "irDetails", "type": "InMageRcmFailbackSyncDetails"}, + "resync_details": {"key": "resyncDetails", "type": "InMageRcmFailbackSyncDetails"}, + "last_sync_time": {"key": "lastSyncTime", "type": "iso-8601"}, } def __init__( self, *, - ir_details: Optional["InMageRcmFailbackSyncDetails"] = None, - resync_details: Optional["InMageRcmFailbackSyncDetails"] = None, + ir_details: Optional["_models.InMageRcmFailbackSyncDetails"] = None, + resync_details: Optional["_models.InMageRcmFailbackSyncDetails"] = None, **kwargs ): - super(InMageRcmFailbackProtectedDiskDetails, self).__init__(**kwargs) + """ + :keyword ir_details: The initial replication details. + :paramtype ir_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails + :keyword resync_details: The resync details. + :paramtype resync_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails + """ + super().__init__(**kwargs) self.disk_id = None self.disk_name = None self.is_os_disk = None @@ -11226,15 +14402,17 @@ def __init__( self.last_sync_time = None -class InMageRcmFailbackReplicationDetails(ReplicationProviderSpecificSettings): +class InMageRcmFailbackReplicationDetails( + ReplicationProviderSpecificSettings +): # pylint: disable=too-many-instance-attributes """InMageRcmFailback provider specific details. 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. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str :ivar internal_identifier: The virtual machine internal identifier. :vartype internal_identifier: str :ivar azure_virtual_machine_id: The ARM Id of the azure VM. @@ -11259,48 +14437,48 @@ class InMageRcmFailbackReplicationDetails(ReplicationProviderSpecificSettings): :vartype initial_replication_progress_percentage: int :ivar initial_replication_processed_bytes: The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM. - :vartype initial_replication_processed_bytes: long + :vartype initial_replication_processed_bytes: int :ivar initial_replication_transferred_bytes: The initial replication transferred bytes from source VM to target for all selected disks on source VM. - :vartype initial_replication_transferred_bytes: long - :ivar initial_replication_progress_health: The initial replication progress health. Possible - values include: "None", "InProgress", "SlowProgress", "NoProgress". + :vartype initial_replication_transferred_bytes: int + :ivar initial_replication_progress_health: The initial replication progress health. Known + values are: "None", "InProgress", "SlowProgress", and "NoProgress". :vartype initial_replication_progress_health: str or ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth :ivar resync_progress_percentage: The resync progress percentage. :vartype resync_progress_percentage: int :ivar resync_processed_bytes: The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM. - :vartype resync_processed_bytes: long + :vartype resync_processed_bytes: int :ivar resync_transferred_bytes: The resync transferred bytes from source VM to target for all selected disks on source VM. - :vartype resync_transferred_bytes: long - :ivar resync_progress_health: The resync progress health. Possible values include: "None", - "InProgress", "SlowProgress", "NoProgress". + :vartype resync_transferred_bytes: int + :ivar resync_progress_health: The resync progress health. Known values are: "None", + "InProgress", "SlowProgress", and "NoProgress". :vartype resync_progress_health: str or ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth :ivar resync_required: A value indicating whether resync is required. :vartype resync_required: str - :ivar resync_state: The resync state. Possible values include: "None", - "PreparedForResynchronization", "StartedResynchronization". + :ivar resync_state: The resync state. Known values are: "None", "PreparedForResynchronization", + and "StartedResynchronization". :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState - :param protected_disks: The list of protected disks. - :type protected_disks: + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackProtectedDiskDetails] - :param mobility_agent_details: The mobility agent information. - :type mobility_agent_details: + :ivar mobility_agent_details: The mobility agent information. + :vartype mobility_agent_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackMobilityAgentDetails - :param vm_nics: The network details. - :type vm_nics: + :ivar vm_nics: The network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackNicDetails] :ivar last_planned_failover_start_time: The last planned failover start time. :vartype last_planned_failover_start_time: ~datetime.datetime - :ivar last_planned_failover_status: The last planned failover status. Possible values include: - "Succeeded", "Failed", "Cancelled", "Unknown". + :ivar last_planned_failover_status: The last planned failover status. Known values are: + "Succeeded", "Failed", "Cancelled", and "Unknown". :vartype last_planned_failover_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverStatus - :param discovered_vm_details: The discovered VM information. - :type discovered_vm_details: + :ivar discovered_vm_details: The discovered VM information. + :vartype discovered_vm_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackDiscoveredProtectedVmDetails :ivar last_used_policy_id: The policy Id used by the forward replication. :vartype last_used_policy_id: str @@ -11312,78 +14490,98 @@ class InMageRcmFailbackReplicationDetails(ReplicationProviderSpecificSettings): """ _validation = { - 'instance_type': {'required': True}, - 'internal_identifier': {'readonly': True}, - 'azure_virtual_machine_id': {'readonly': True}, - 'multi_vm_group_name': {'readonly': True}, - 'reprotect_agent_id': {'readonly': True}, - 'reprotect_agent_name': {'readonly': True}, - 'os_type': {'readonly': True}, - 'log_storage_account_id': {'readonly': True}, - 'targetv_center_id': {'readonly': True}, - 'target_data_store_name': {'readonly': True}, - 'target_vm_name': {'readonly': True}, - 'initial_replication_progress_percentage': {'readonly': True}, - 'initial_replication_processed_bytes': {'readonly': True}, - 'initial_replication_transferred_bytes': {'readonly': True}, - 'initial_replication_progress_health': {'readonly': True}, - 'resync_progress_percentage': {'readonly': True}, - 'resync_processed_bytes': {'readonly': True}, - 'resync_transferred_bytes': {'readonly': True}, - 'resync_progress_health': {'readonly': True}, - 'resync_required': {'readonly': True}, - 'resync_state': {'readonly': True}, - 'last_planned_failover_start_time': {'readonly': True}, - 'last_planned_failover_status': {'readonly': True}, - 'last_used_policy_id': {'readonly': True}, - 'last_used_policy_friendly_name': {'readonly': True}, - 'is_agent_registration_successful_after_failover': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'internal_identifier': {'key': 'internalIdentifier', 'type': 'str'}, - 'azure_virtual_machine_id': {'key': 'azureVirtualMachineId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'reprotect_agent_id': {'key': 'reprotectAgentId', 'type': 'str'}, - 'reprotect_agent_name': {'key': 'reprotectAgentName', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'targetv_center_id': {'key': 'targetvCenterId', 'type': 'str'}, - 'target_data_store_name': {'key': 'targetDataStoreName', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'initial_replication_progress_percentage': {'key': 'initialReplicationProgressPercentage', 'type': 'int'}, - 'initial_replication_processed_bytes': {'key': 'initialReplicationProcessedBytes', 'type': 'long'}, - 'initial_replication_transferred_bytes': {'key': 'initialReplicationTransferredBytes', 'type': 'long'}, - 'initial_replication_progress_health': {'key': 'initialReplicationProgressHealth', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'resync_processed_bytes': {'key': 'resyncProcessedBytes', 'type': 'long'}, - 'resync_transferred_bytes': {'key': 'resyncTransferredBytes', 'type': 'long'}, - 'resync_progress_health': {'key': 'resyncProgressHealth', 'type': 'str'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_state': {'key': 'resyncState', 'type': 'str'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[InMageRcmFailbackProtectedDiskDetails]'}, - 'mobility_agent_details': {'key': 'mobilityAgentDetails', 'type': 'InMageRcmFailbackMobilityAgentDetails'}, - 'vm_nics': {'key': 'vmNics', 'type': '[InMageRcmFailbackNicDetails]'}, - 'last_planned_failover_start_time': {'key': 'lastPlannedFailoverStartTime', 'type': 'iso-8601'}, - 'last_planned_failover_status': {'key': 'lastPlannedFailoverStatus', 'type': 'str'}, - 'discovered_vm_details': {'key': 'discoveredVmDetails', 'type': 'InMageRcmFailbackDiscoveredProtectedVmDetails'}, - 'last_used_policy_id': {'key': 'lastUsedPolicyId', 'type': 'str'}, - 'last_used_policy_friendly_name': {'key': 'lastUsedPolicyFriendlyName', 'type': 'str'}, - 'is_agent_registration_successful_after_failover': {'key': 'isAgentRegistrationSuccessfulAfterFailover', 'type': 'bool'}, - } - - def __init__( - self, - *, - protected_disks: Optional[List["InMageRcmFailbackProtectedDiskDetails"]] = None, - mobility_agent_details: Optional["InMageRcmFailbackMobilityAgentDetails"] = None, - vm_nics: Optional[List["InMageRcmFailbackNicDetails"]] = None, - discovered_vm_details: Optional["InMageRcmFailbackDiscoveredProtectedVmDetails"] = None, - **kwargs - ): - super(InMageRcmFailbackReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str + "instance_type": {"required": True}, + "internal_identifier": {"readonly": True}, + "azure_virtual_machine_id": {"readonly": True}, + "multi_vm_group_name": {"readonly": True}, + "reprotect_agent_id": {"readonly": True}, + "reprotect_agent_name": {"readonly": True}, + "os_type": {"readonly": True}, + "log_storage_account_id": {"readonly": True}, + "targetv_center_id": {"readonly": True}, + "target_data_store_name": {"readonly": True}, + "target_vm_name": {"readonly": True}, + "initial_replication_progress_percentage": {"readonly": True}, + "initial_replication_processed_bytes": {"readonly": True}, + "initial_replication_transferred_bytes": {"readonly": True}, + "initial_replication_progress_health": {"readonly": True}, + "resync_progress_percentage": {"readonly": True}, + "resync_processed_bytes": {"readonly": True}, + "resync_transferred_bytes": {"readonly": True}, + "resync_progress_health": {"readonly": True}, + "resync_required": {"readonly": True}, + "resync_state": {"readonly": True}, + "last_planned_failover_start_time": {"readonly": True}, + "last_planned_failover_status": {"readonly": True}, + "last_used_policy_id": {"readonly": True}, + "last_used_policy_friendly_name": {"readonly": True}, + "is_agent_registration_successful_after_failover": {"readonly": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "internal_identifier": {"key": "internalIdentifier", "type": "str"}, + "azure_virtual_machine_id": {"key": "azureVirtualMachineId", "type": "str"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "reprotect_agent_id": {"key": "reprotectAgentId", "type": "str"}, + "reprotect_agent_name": {"key": "reprotectAgentName", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "targetv_center_id": {"key": "targetvCenterId", "type": "str"}, + "target_data_store_name": {"key": "targetDataStoreName", "type": "str"}, + "target_vm_name": {"key": "targetVmName", "type": "str"}, + "initial_replication_progress_percentage": {"key": "initialReplicationProgressPercentage", "type": "int"}, + "initial_replication_processed_bytes": {"key": "initialReplicationProcessedBytes", "type": "int"}, + "initial_replication_transferred_bytes": {"key": "initialReplicationTransferredBytes", "type": "int"}, + "initial_replication_progress_health": {"key": "initialReplicationProgressHealth", "type": "str"}, + "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, + "resync_processed_bytes": {"key": "resyncProcessedBytes", "type": "int"}, + "resync_transferred_bytes": {"key": "resyncTransferredBytes", "type": "int"}, + "resync_progress_health": {"key": "resyncProgressHealth", "type": "str"}, + "resync_required": {"key": "resyncRequired", "type": "str"}, + "resync_state": {"key": "resyncState", "type": "str"}, + "protected_disks": {"key": "protectedDisks", "type": "[InMageRcmFailbackProtectedDiskDetails]"}, + "mobility_agent_details": {"key": "mobilityAgentDetails", "type": "InMageRcmFailbackMobilityAgentDetails"}, + "vm_nics": {"key": "vmNics", "type": "[InMageRcmFailbackNicDetails]"}, + "last_planned_failover_start_time": {"key": "lastPlannedFailoverStartTime", "type": "iso-8601"}, + "last_planned_failover_status": {"key": "lastPlannedFailoverStatus", "type": "str"}, + "discovered_vm_details": { + "key": "discoveredVmDetails", + "type": "InMageRcmFailbackDiscoveredProtectedVmDetails", + }, + "last_used_policy_id": {"key": "lastUsedPolicyId", "type": "str"}, + "last_used_policy_friendly_name": {"key": "lastUsedPolicyFriendlyName", "type": "str"}, + "is_agent_registration_successful_after_failover": { + "key": "isAgentRegistrationSuccessfulAfterFailover", + "type": "bool", + }, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + protected_disks: Optional[List["_models.InMageRcmFailbackProtectedDiskDetails"]] = None, + mobility_agent_details: Optional["_models.InMageRcmFailbackMobilityAgentDetails"] = None, + vm_nics: Optional[List["_models.InMageRcmFailbackNicDetails"]] = None, + discovered_vm_details: Optional["_models.InMageRcmFailbackDiscoveredProtectedVmDetails"] = None, + **kwargs + ): + """ + :keyword protected_disks: The list of protected disks. + :paramtype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackProtectedDiskDetails] + :keyword mobility_agent_details: The mobility agent information. + :paramtype mobility_agent_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackMobilityAgentDetails + :keyword vm_nics: The network details. + :paramtype vm_nics: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackNicDetails] + :keyword discovered_vm_details: The discovered VM information. + :paramtype discovered_vm_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackDiscoveredProtectedVmDetails + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcmFailback" # type: str self.internal_identifier = None self.azure_virtual_machine_id = None self.multi_vm_group_name = None @@ -11420,63 +14618,64 @@ class InMageRcmFailbackReprotectInput(ReverseReplicationProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param process_server_id: Required. The process server Id. - :type process_server_id: str - :param run_as_account_id: The run as account Id. - :type run_as_account_id: str - :param policy_id: Required. The Policy Id. - :type policy_id: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar process_server_id: The process server Id. Required. + :vartype process_server_id: str + :ivar run_as_account_id: The run as account Id. + :vartype run_as_account_id: str + :ivar policy_id: The Policy Id. Required. + :vartype policy_id: str """ _validation = { - 'instance_type': {'required': True}, - 'process_server_id': {'required': True}, - 'policy_id': {'required': True}, + "instance_type": {"required": True}, + "process_server_id": {"required": True}, + "policy_id": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, } - def __init__( - self, - *, - process_server_id: str, - policy_id: str, - run_as_account_id: Optional[str] = None, - **kwargs - ): - super(InMageRcmFailbackReprotectInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str + def __init__(self, *, process_server_id: str, policy_id: str, run_as_account_id: Optional[str] = None, **kwargs): + """ + :keyword process_server_id: The process server Id. Required. + :paramtype process_server_id: str + :keyword run_as_account_id: The run as account Id. + :paramtype run_as_account_id: str + :keyword policy_id: The Policy Id. Required. + :paramtype policy_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcmFailback" # type: str self.process_server_id = process_server_id self.run_as_account_id = run_as_account_id self.policy_id = policy_id -class InMageRcmFailbackSyncDetails(msrest.serialization.Model): +class InMageRcmFailbackSyncDetails(_serialization.Model): """InMageRcmFailback disk level sync details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar progress_health: The progress health. Possible values include: "None", "InProgress", - "SlowProgress", "NoProgress", "Queued". + :ivar progress_health: The progress health. Known values are: "None", "InProgress", + "SlowProgress", "NoProgress", and "Queued". :vartype progress_health: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskReplicationProgressHealth :ivar transferred_bytes: The transferred bytes from source VM to azure for the disk. - :vartype transferred_bytes: long + :vartype transferred_bytes: int :ivar last15_minutes_transferred_bytes: The bytes transferred in last 15 minutes from source VM to target. - :vartype last15_minutes_transferred_bytes: long + :vartype last15_minutes_transferred_bytes: int :ivar last_data_transfer_time_utc: The time of the last data transfer from source VM to target. :vartype last_data_transfer_time_utc: str :ivar processed_bytes: The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. - :vartype processed_bytes: long + :vartype processed_bytes: int :ivar start_time: The start time. :vartype start_time: str :ivar last_refresh_time: The last refresh time. @@ -11487,32 +14686,30 @@ class InMageRcmFailbackSyncDetails(msrest.serialization.Model): """ _validation = { - 'progress_health': {'readonly': True}, - 'transferred_bytes': {'readonly': True}, - 'last15_minutes_transferred_bytes': {'readonly': True}, - 'last_data_transfer_time_utc': {'readonly': True}, - 'processed_bytes': {'readonly': True}, - 'start_time': {'readonly': True}, - 'last_refresh_time': {'readonly': True}, - 'progress_percentage': {'readonly': True}, + "progress_health": {"readonly": True}, + "transferred_bytes": {"readonly": True}, + "last15_minutes_transferred_bytes": {"readonly": True}, + "last_data_transfer_time_utc": {"readonly": True}, + "processed_bytes": {"readonly": True}, + "start_time": {"readonly": True}, + "last_refresh_time": {"readonly": True}, + "progress_percentage": {"readonly": True}, } _attribute_map = { - 'progress_health': {'key': 'progressHealth', 'type': 'str'}, - 'transferred_bytes': {'key': 'transferredBytes', 'type': 'long'}, - 'last15_minutes_transferred_bytes': {'key': 'last15MinutesTransferredBytes', 'type': 'long'}, - 'last_data_transfer_time_utc': {'key': 'lastDataTransferTimeUtc', 'type': 'str'}, - 'processed_bytes': {'key': 'processedBytes', 'type': 'long'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'last_refresh_time': {'key': 'lastRefreshTime', 'type': 'str'}, - 'progress_percentage': {'key': 'progressPercentage', 'type': 'int'}, + "progress_health": {"key": "progressHealth", "type": "str"}, + "transferred_bytes": {"key": "transferredBytes", "type": "int"}, + "last15_minutes_transferred_bytes": {"key": "last15MinutesTransferredBytes", "type": "int"}, + "last_data_transfer_time_utc": {"key": "lastDataTransferTimeUtc", "type": "str"}, + "processed_bytes": {"key": "processedBytes", "type": "int"}, + "start_time": {"key": "startTime", "type": "str"}, + "last_refresh_time": {"key": "lastRefreshTime", "type": "str"}, + "progress_percentage": {"key": "progressPercentage", "type": "int"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmFailbackSyncDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.progress_health = None self.transferred_bytes = None self.last15_minutes_transferred_bytes = None @@ -11523,7 +14720,7 @@ def __init__( self.progress_percentage = None -class InMageRcmLastAgentUpgradeErrorDetails(msrest.serialization.Model): +class InMageRcmLastAgentUpgradeErrorDetails(_serialization.Model): """InMageRcm last source agent upgrade error details. Variables are only populated by the server, and will be ignored when sending a request. @@ -11543,28 +14740,26 @@ class InMageRcmLastAgentUpgradeErrorDetails(msrest.serialization.Model): """ _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'possible_causes': {'readonly': True}, - 'recommended_action': {'readonly': True}, - 'error_message_parameters': {'readonly': True}, - 'error_tags': {'readonly': True}, + "error_code": {"readonly": True}, + "error_message": {"readonly": True}, + "possible_causes": {"readonly": True}, + "recommended_action": {"readonly": True}, + "error_message_parameters": {"readonly": True}, + "error_tags": {"readonly": True}, } _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'error_message_parameters': {'key': 'errorMessageParameters', 'type': '{str}'}, - 'error_tags': {'key': 'errorTags', 'type': '{str}'}, + "error_code": {"key": "errorCode", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, + "error_tags": {"key": "errorTags", "type": "{str}"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmLastAgentUpgradeErrorDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error_code = None self.error_message = None self.possible_causes = None @@ -11573,7 +14768,7 @@ def __init__( self.error_tags = None -class InMageRcmMobilityAgentDetails(msrest.serialization.Model): +class InMageRcmMobilityAgentDetails(_serialization.Model): """InMageRcm mobility agent details. Variables are only populated by the server, and will be ignored when sending a request. @@ -11603,36 +14798,34 @@ class InMageRcmMobilityAgentDetails(msrest.serialization.Model): """ _validation = { - 'version': {'readonly': True}, - 'latest_version': {'readonly': True}, - 'latest_agent_release_date': {'readonly': True}, - 'driver_version': {'readonly': True}, - 'latest_upgradable_version_without_reboot': {'readonly': True}, - 'agent_version_expiry_date': {'readonly': True}, - 'driver_version_expiry_date': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'reasons_blocking_upgrade': {'readonly': True}, - 'is_upgradeable': {'readonly': True}, + "version": {"readonly": True}, + "latest_version": {"readonly": True}, + "latest_agent_release_date": {"readonly": True}, + "driver_version": {"readonly": True}, + "latest_upgradable_version_without_reboot": {"readonly": True}, + "agent_version_expiry_date": {"readonly": True}, + "driver_version_expiry_date": {"readonly": True}, + "last_heartbeat_utc": {"readonly": True}, + "reasons_blocking_upgrade": {"readonly": True}, + "is_upgradeable": {"readonly": True}, } _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'latest_agent_release_date': {'key': 'latestAgentReleaseDate', 'type': 'str'}, - 'driver_version': {'key': 'driverVersion', 'type': 'str'}, - 'latest_upgradable_version_without_reboot': {'key': 'latestUpgradableVersionWithoutReboot', 'type': 'str'}, - 'agent_version_expiry_date': {'key': 'agentVersionExpiryDate', 'type': 'iso-8601'}, - 'driver_version_expiry_date': {'key': 'driverVersionExpiryDate', 'type': 'iso-8601'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'reasons_blocking_upgrade': {'key': 'reasonsBlockingUpgrade', 'type': '[str]'}, - 'is_upgradeable': {'key': 'isUpgradeable', 'type': 'str'}, + "version": {"key": "version", "type": "str"}, + "latest_version": {"key": "latestVersion", "type": "str"}, + "latest_agent_release_date": {"key": "latestAgentReleaseDate", "type": "str"}, + "driver_version": {"key": "driverVersion", "type": "str"}, + "latest_upgradable_version_without_reboot": {"key": "latestUpgradableVersionWithoutReboot", "type": "str"}, + "agent_version_expiry_date": {"key": "agentVersionExpiryDate", "type": "iso-8601"}, + "driver_version_expiry_date": {"key": "driverVersionExpiryDate", "type": "iso-8601"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "reasons_blocking_upgrade": {"key": "reasonsBlockingUpgrade", "type": "[str]"}, + "is_upgradeable": {"key": "isUpgradeable", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmMobilityAgentDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.version = None self.latest_version = None self.latest_agent_release_date = None @@ -11645,20 +14838,20 @@ def __init__( self.is_upgradeable = None -class InMageRcmNicDetails(msrest.serialization.Model): +class InMageRcmNicDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """InMageRcm NIC details. Variables are only populated by the server, and will be ignored when sending a request. :ivar nic_id: The NIC Id. :vartype nic_id: str - :param is_primary_nic: A value indicating whether this is the primary NIC. - :type is_primary_nic: str - :param is_selected_for_failover: A value indicating whether this NIC is selected for failover. - :type is_selected_for_failover: str + :ivar is_primary_nic: A value indicating whether this is the primary NIC. + :vartype is_primary_nic: str + :ivar is_selected_for_failover: A value indicating whether this NIC is selected for failover. + :vartype is_selected_for_failover: str :ivar source_ip_address: The source IP address. :vartype source_ip_address: str - :ivar source_ip_address_type: The source IP address type. Possible values include: "Dynamic", + :ivar source_ip_address_type: The source IP address type. Known values are: "Dynamic" and "Static". :vartype source_ip_address_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType @@ -11666,46 +14859,45 @@ class InMageRcmNicDetails(msrest.serialization.Model): :vartype source_network_id: str :ivar source_subnet_name: Source subnet name. :vartype source_subnet_name: str - :param target_ip_address: The target IP address. - :type target_ip_address: str - :param target_ip_address_type: The target IP address type. Possible values include: "Dynamic", + :ivar target_ip_address: The target IP address. + :vartype target_ip_address: str + :ivar target_ip_address_type: The target IP address type. Known values are: "Dynamic" and "Static". - :type target_ip_address_type: str or + :vartype target_ip_address_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :param target_subnet_name: Target subnet name. - :type target_subnet_name: str - :param test_subnet_name: Test subnet name. - :type test_subnet_name: str - :param test_ip_address: The test IP address. - :type test_ip_address: str - :param test_ip_address_type: The test IP address type. Possible values include: "Dynamic", - "Static". - :type test_ip_address_type: str or + :ivar target_subnet_name: Target subnet name. + :vartype target_subnet_name: str + :ivar test_subnet_name: Test subnet name. + :vartype test_subnet_name: str + :ivar test_ip_address: The test IP address. + :vartype test_ip_address: str + :ivar test_ip_address_type: The test IP address type. Known values are: "Dynamic" and "Static". + :vartype test_ip_address_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType """ _validation = { - 'nic_id': {'readonly': True}, - 'source_ip_address': {'readonly': True}, - 'source_ip_address_type': {'readonly': True}, - 'source_network_id': {'readonly': True}, - 'source_subnet_name': {'readonly': True}, + "nic_id": {"readonly": True}, + "source_ip_address": {"readonly": True}, + "source_ip_address_type": {"readonly": True}, + "source_network_id": {"readonly": True}, + "source_subnet_name": {"readonly": True}, } _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'is_primary_nic': {'key': 'isPrimaryNic', 'type': 'str'}, - 'is_selected_for_failover': {'key': 'isSelectedForFailover', 'type': 'str'}, - 'source_ip_address': {'key': 'sourceIPAddress', 'type': 'str'}, - 'source_ip_address_type': {'key': 'sourceIPAddressType', 'type': 'str'}, - 'source_network_id': {'key': 'sourceNetworkId', 'type': 'str'}, - 'source_subnet_name': {'key': 'sourceSubnetName', 'type': 'str'}, - 'target_ip_address': {'key': 'targetIPAddress', 'type': 'str'}, - 'target_ip_address_type': {'key': 'targetIPAddressType', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'test_subnet_name': {'key': 'testSubnetName', 'type': 'str'}, - 'test_ip_address': {'key': 'testIPAddress', 'type': 'str'}, - 'test_ip_address_type': {'key': 'testIPAddressType', 'type': 'str'}, + "nic_id": {"key": "nicId", "type": "str"}, + "is_primary_nic": {"key": "isPrimaryNic", "type": "str"}, + "is_selected_for_failover": {"key": "isSelectedForFailover", "type": "str"}, + "source_ip_address": {"key": "sourceIPAddress", "type": "str"}, + "source_ip_address_type": {"key": "sourceIPAddressType", "type": "str"}, + "source_network_id": {"key": "sourceNetworkId", "type": "str"}, + "source_subnet_name": {"key": "sourceSubnetName", "type": "str"}, + "target_ip_address": {"key": "targetIPAddress", "type": "str"}, + "target_ip_address_type": {"key": "targetIPAddressType", "type": "str"}, + "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, + "test_subnet_name": {"key": "testSubnetName", "type": "str"}, + "test_ip_address": {"key": "testIPAddress", "type": "str"}, + "test_ip_address_type": {"key": "testIPAddressType", "type": "str"}, } def __init__( @@ -11714,14 +14906,37 @@ def __init__( is_primary_nic: Optional[str] = None, is_selected_for_failover: Optional[str] = None, target_ip_address: Optional[str] = None, - target_ip_address_type: Optional[Union[str, "EthernetAddressType"]] = None, + target_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, target_subnet_name: Optional[str] = None, test_subnet_name: Optional[str] = None, test_ip_address: Optional[str] = None, - test_ip_address_type: Optional[Union[str, "EthernetAddressType"]] = None, - **kwargs - ): - super(InMageRcmNicDetails, self).__init__(**kwargs) + test_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, + **kwargs + ): + """ + :keyword is_primary_nic: A value indicating whether this is the primary NIC. + :paramtype is_primary_nic: str + :keyword is_selected_for_failover: A value indicating whether this NIC is selected for + failover. + :paramtype is_selected_for_failover: str + :keyword target_ip_address: The target IP address. + :paramtype target_ip_address: str + :keyword target_ip_address_type: The target IP address type. Known values are: "Dynamic" and + "Static". + :paramtype target_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :keyword target_subnet_name: Target subnet name. + :paramtype target_subnet_name: str + :keyword test_subnet_name: Test subnet name. + :paramtype test_subnet_name: str + :keyword test_ip_address: The test IP address. + :paramtype test_ip_address: str + :keyword test_ip_address_type: The test IP address type. Known values are: "Dynamic" and + "Static". + :paramtype test_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + """ + super().__init__(**kwargs) self.nic_id = None self.is_primary_nic = is_primary_nic self.is_selected_for_failover = is_selected_for_failover @@ -11737,40 +14952,40 @@ def __init__( self.test_ip_address_type = test_ip_address_type -class InMageRcmNicInput(msrest.serialization.Model): +class InMageRcmNicInput(_serialization.Model): """InMageRcm NIC input. All required parameters must be populated in order to send to Azure. - :param nic_id: Required. The NIC Id. - :type nic_id: str - :param is_primary_nic: Required. A value indicating whether this is the primary NIC. - :type is_primary_nic: str - :param is_selected_for_failover: A value indicating whether this NIC is selected for failover. - :type is_selected_for_failover: str - :param target_subnet_name: Target subnet name. - :type target_subnet_name: str - :param target_static_ip_address: The target static IP address. - :type target_static_ip_address: str - :param test_subnet_name: The test subnet name. - :type test_subnet_name: str - :param test_static_ip_address: The test static IP address. - :type test_static_ip_address: str + :ivar nic_id: The NIC Id. Required. + :vartype nic_id: str + :ivar is_primary_nic: A value indicating whether this is the primary NIC. Required. + :vartype is_primary_nic: str + :ivar is_selected_for_failover: A value indicating whether this NIC is selected for failover. + :vartype is_selected_for_failover: str + :ivar target_subnet_name: Target subnet name. + :vartype target_subnet_name: str + :ivar target_static_ip_address: The target static IP address. + :vartype target_static_ip_address: str + :ivar test_subnet_name: The test subnet name. + :vartype test_subnet_name: str + :ivar test_static_ip_address: The test static IP address. + :vartype test_static_ip_address: str """ _validation = { - 'nic_id': {'required': True}, - 'is_primary_nic': {'required': True}, + "nic_id": {"required": True}, + "is_primary_nic": {"required": True}, } _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'is_primary_nic': {'key': 'isPrimaryNic', 'type': 'str'}, - 'is_selected_for_failover': {'key': 'isSelectedForFailover', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'target_static_ip_address': {'key': 'targetStaticIPAddress', 'type': 'str'}, - 'test_subnet_name': {'key': 'testSubnetName', 'type': 'str'}, - 'test_static_ip_address': {'key': 'testStaticIPAddress', 'type': 'str'}, + "nic_id": {"key": "nicId", "type": "str"}, + "is_primary_nic": {"key": "isPrimaryNic", "type": "str"}, + "is_selected_for_failover": {"key": "isSelectedForFailover", "type": "str"}, + "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, + "target_static_ip_address": {"key": "targetStaticIPAddress", "type": "str"}, + "test_subnet_name": {"key": "testSubnetName", "type": "str"}, + "test_static_ip_address": {"key": "testStaticIPAddress", "type": "str"}, } def __init__( @@ -11785,7 +15000,24 @@ def __init__( test_static_ip_address: Optional[str] = None, **kwargs ): - super(InMageRcmNicInput, self).__init__(**kwargs) + """ + :keyword nic_id: The NIC Id. Required. + :paramtype nic_id: str + :keyword is_primary_nic: A value indicating whether this is the primary NIC. Required. + :paramtype is_primary_nic: str + :keyword is_selected_for_failover: A value indicating whether this NIC is selected for + failover. + :paramtype is_selected_for_failover: str + :keyword target_subnet_name: Target subnet name. + :paramtype target_subnet_name: str + :keyword target_static_ip_address: The target static IP address. + :paramtype target_static_ip_address: str + :keyword test_subnet_name: The test subnet name. + :paramtype test_subnet_name: str + :keyword test_static_ip_address: The test static IP address. + :paramtype test_static_ip_address: str + """ + super().__init__(**kwargs) self.nic_id = nic_id self.is_primary_nic = is_primary_nic self.is_selected_for_failover = is_selected_for_failover @@ -11800,30 +15032,30 @@ class InMageRcmPolicyCreationInput(PolicyProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_history_in_minutes: The duration in minutes until which the recovery + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + :vartype recovery_point_history_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. - :type enable_multi_vm_sync: str + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. + :vartype enable_multi_vm_sync: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_in_minutes': {'key': 'recoveryPointHistoryInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'enable_multi_vm_sync': {'key': 'enableMultiVmSync', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "enable_multi_vm_sync": {"key": "enableMultiVmSync", "type": "str"}, } def __init__( @@ -11835,8 +15067,21 @@ def __init__( enable_multi_vm_sync: Optional[str] = None, **kwargs ): - super(InMageRcmPolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + """ + :keyword recovery_point_history_in_minutes: The duration in minutes until which the recovery + points need to be stored. + :paramtype recovery_point_history_in_minutes: int + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :paramtype crash_consistent_frequency_in_minutes: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in + minutes). + :paramtype app_consistent_frequency_in_minutes: int + :keyword enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. + :paramtype enable_multi_vm_sync: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.recovery_point_history_in_minutes = recovery_point_history_in_minutes self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes @@ -11848,31 +15093,30 @@ class InMageRcmPolicyDetails(PolicyProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_history_in_minutes: The duration in minutes until which the recovery + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + :vartype recovery_point_history_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in minutes. - :type crash_consistent_frequency_in_minutes: int - :param enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. - :type enable_multi_vm_sync: str + :vartype crash_consistent_frequency_in_minutes: int + :ivar enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. + :vartype enable_multi_vm_sync: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_in_minutes': {'key': 'recoveryPointHistoryInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'enable_multi_vm_sync': {'key': 'enableMultiVmSync', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, + "enable_multi_vm_sync": {"key": "enableMultiVmSync", "type": "str"}, } def __init__( @@ -11884,15 +15128,27 @@ def __init__( enable_multi_vm_sync: Optional[str] = None, **kwargs ): - super(InMageRcmPolicyDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + """ + :keyword recovery_point_history_in_minutes: The duration in minutes until which the recovery + points need to be stored. + :paramtype recovery_point_history_in_minutes: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :paramtype app_consistent_frequency_in_minutes: int + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :paramtype crash_consistent_frequency_in_minutes: int + :keyword enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. + :paramtype enable_multi_vm_sync: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.recovery_point_history_in_minutes = recovery_point_history_in_minutes self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes self.enable_multi_vm_sync = enable_multi_vm_sync -class InMageRcmProtectedDiskDetails(msrest.serialization.Model): +class InMageRcmProtectedDiskDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """InMageRcm protected disk details. Variables are only populated by the server, and will be ignored when sending a request. @@ -11904,18 +15160,20 @@ class InMageRcmProtectedDiskDetails(msrest.serialization.Model): :ivar is_os_disk: A value indicating whether the disk is the OS disk. :vartype is_os_disk: str :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: long + :vartype capacity_in_bytes: int :ivar log_storage_account_id: The log storage account ARM Id. :vartype log_storage_account_id: str :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. :vartype disk_encryption_set_id: str :ivar seed_managed_disk_id: The ARM Id of the seed managed disk. :vartype seed_managed_disk_id: str + :ivar seed_blob_uri: The uri of the seed blob. + :vartype seed_blob_uri: str :ivar target_managed_disk_id: The ARM Id of the target managed disk. :vartype target_managed_disk_id: str - :param disk_type: The disk type. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType :ivar data_pending_in_log_data_store_in_mb: The data pending in log data store in MB. :vartype data_pending_in_log_data_store_in_mb: float :ivar data_pending_at_source_agent_in_mb: The data pending at source agent in MB. @@ -11923,52 +15181,63 @@ class InMageRcmProtectedDiskDetails(msrest.serialization.Model): :ivar is_initial_replication_complete: A value indicating whether initial replication is complete or not. :vartype is_initial_replication_complete: str - :param ir_details: The initial replication details. - :type ir_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails - :param resync_details: The resync details. - :type resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails - """ - - _validation = { - 'disk_id': {'readonly': True}, - 'disk_name': {'readonly': True}, - 'is_os_disk': {'readonly': True}, - 'capacity_in_bytes': {'readonly': True}, - 'log_storage_account_id': {'readonly': True}, - 'disk_encryption_set_id': {'readonly': True}, - 'seed_managed_disk_id': {'readonly': True}, - 'target_managed_disk_id': {'readonly': True}, - 'data_pending_in_log_data_store_in_mb': {'readonly': True}, - 'data_pending_at_source_agent_in_mb': {'readonly': True}, - 'is_initial_replication_complete': {'readonly': True}, - } - - _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'seed_managed_disk_id': {'key': 'seedManagedDiskId', 'type': 'str'}, - 'target_managed_disk_id': {'key': 'targetManagedDiskId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'data_pending_in_log_data_store_in_mb': {'key': 'dataPendingInLogDataStoreInMB', 'type': 'float'}, - 'data_pending_at_source_agent_in_mb': {'key': 'dataPendingAtSourceAgentInMB', 'type': 'float'}, - 'is_initial_replication_complete': {'key': 'isInitialReplicationComplete', 'type': 'str'}, - 'ir_details': {'key': 'irDetails', 'type': 'InMageRcmSyncDetails'}, - 'resync_details': {'key': 'resyncDetails', 'type': 'InMageRcmSyncDetails'}, - } - - def __init__( - self, - *, - disk_type: Optional[Union[str, "DiskAccountType"]] = None, - ir_details: Optional["InMageRcmSyncDetails"] = None, - resync_details: Optional["InMageRcmSyncDetails"] = None, - **kwargs - ): - super(InMageRcmProtectedDiskDetails, self).__init__(**kwargs) + :ivar ir_details: The initial replication details. + :vartype ir_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails + :ivar resync_details: The resync details. + :vartype resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails + """ + + _validation = { + "disk_id": {"readonly": True}, + "disk_name": {"readonly": True}, + "is_os_disk": {"readonly": True}, + "capacity_in_bytes": {"readonly": True}, + "log_storage_account_id": {"readonly": True}, + "disk_encryption_set_id": {"readonly": True}, + "seed_managed_disk_id": {"readonly": True}, + "seed_blob_uri": {"readonly": True}, + "target_managed_disk_id": {"readonly": True}, + "data_pending_in_log_data_store_in_mb": {"readonly": True}, + "data_pending_at_source_agent_in_mb": {"readonly": True}, + "is_initial_replication_complete": {"readonly": True}, + } + + _attribute_map = { + "disk_id": {"key": "diskId", "type": "str"}, + "disk_name": {"key": "diskName", "type": "str"}, + "is_os_disk": {"key": "isOSDisk", "type": "str"}, + "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, + "seed_managed_disk_id": {"key": "seedManagedDiskId", "type": "str"}, + "seed_blob_uri": {"key": "seedBlobUri", "type": "str"}, + "target_managed_disk_id": {"key": "targetManagedDiskId", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "data_pending_in_log_data_store_in_mb": {"key": "dataPendingInLogDataStoreInMB", "type": "float"}, + "data_pending_at_source_agent_in_mb": {"key": "dataPendingAtSourceAgentInMB", "type": "float"}, + "is_initial_replication_complete": {"key": "isInitialReplicationComplete", "type": "str"}, + "ir_details": {"key": "irDetails", "type": "InMageRcmSyncDetails"}, + "resync_details": {"key": "resyncDetails", "type": "InMageRcmSyncDetails"}, + } + + def __init__( + self, + *, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + ir_details: Optional["_models.InMageRcmSyncDetails"] = None, + resync_details: Optional["_models.InMageRcmSyncDetails"] = None, + **kwargs + ): + """ + :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", and + "StandardSSD_LRS". + :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :keyword ir_details: The initial replication details. + :paramtype ir_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails + :keyword resync_details: The resync details. + :paramtype resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails + """ + super().__init__(**kwargs) self.disk_id = None self.disk_name = None self.is_os_disk = None @@ -11976,6 +15245,7 @@ def __init__( self.log_storage_account_id = None self.disk_encryption_set_id = None self.seed_managed_disk_id = None + self.seed_blob_uri = None self.target_managed_disk_id = None self.disk_type = disk_type self.data_pending_in_log_data_store_in_mb = None @@ -11992,30 +15262,27 @@ class InMageRcmProtectionContainerMappingDetails(ProtectionContainerMappingProvi All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str :ivar enable_agent_auto_upgrade: A value indicating whether the flag for enable agent auto upgrade. :vartype enable_agent_auto_upgrade: str """ _validation = { - 'instance_type': {'required': True}, - 'enable_agent_auto_upgrade': {'readonly': True}, + "instance_type": {"required": True}, + "enable_agent_auto_upgrade": {"readonly": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'enable_agent_auto_upgrade': {'key': 'enableAgentAutoUpgrade', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "enable_agent_auto_upgrade": {"key": "enableAgentAutoUpgrade", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmProtectionContainerMappingDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.enable_agent_auto_upgrade = None @@ -12026,41 +15293,39 @@ class InMageRcmRecoveryPointDetails(ProviderSpecificRecoveryPointDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the provider type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the provider type. Required. + :vartype instance_type: str :ivar is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM consistent. :vartype is_multi_vm_sync_point: str """ _validation = { - 'instance_type': {'required': True}, - 'is_multi_vm_sync_point': {'readonly': True}, + "instance_type": {"required": True}, + "is_multi_vm_sync_point": {"readonly": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'is_multi_vm_sync_point': {'key': 'isMultiVmSyncPoint', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "is_multi_vm_sync_point": {"key": "isMultiVmSyncPoint", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmRecoveryPointDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.is_multi_vm_sync_point = None -class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings): +class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings): # pylint: disable=too-many-instance-attributes """InMageRcm provider specific details. 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. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str :ivar internal_identifier: The virtual machine internal identifier. :vartype internal_identifier: str :ivar fabric_discovery_machine_id: The ARM Id of the discovered VM. @@ -12087,35 +15352,38 @@ class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings): :vartype primary_nic_ip_address: str :ivar target_generation: The target generation. :vartype target_generation: str - :param license_type: License Type of the VM to be used. - :type license_type: str - :param target_vm_name: Target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_resource_group_id: The target resource group Id. - :type target_resource_group_id: str - :param target_location: The target location. - :type target_location: str - :param target_availability_set_id: The target availability set Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + :ivar license_type: License Type of the VM to be used. + :vartype license_type: str + :ivar storage_account_id: The replication storage account ARM Id. This is applicable only for + the blob based replication test hook. + :vartype storage_account_id: str + :ivar target_vm_name: Target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_resource_group_id: The target resource group Id. + :vartype target_resource_group_id: str + :ivar target_location: The target location. + :vartype target_location: str + :ivar target_availability_set_id: The target availability set Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param target_network_id: The target network Id. - :type target_network_id: str - :param test_network_id: The test network Id. - :type test_network_id: str + :vartype target_boot_diagnostics_storage_account_id: str + :ivar target_network_id: The target network Id. + :vartype target_network_id: str + :ivar test_network_id: The test network Id. + :vartype test_network_id: str :ivar failover_recovery_point_id: The recovery point Id to which the VM was failed over. :vartype failover_recovery_point_id: str :ivar last_recovery_point_received: The last recovery point received time. :vartype last_recovery_point_received: ~datetime.datetime :ivar last_rpo_in_seconds: The last recovery point objective value. - :vartype last_rpo_in_seconds: long + :vartype last_rpo_in_seconds: int :ivar last_rpo_calculated_time: The last recovery point objective calculated time. :vartype last_rpo_calculated_time: ~datetime.datetime :ivar last_recovery_point_id: The last recovery point Id. @@ -12125,12 +15393,12 @@ class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings): :vartype initial_replication_progress_percentage: int :ivar initial_replication_processed_bytes: The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM. - :vartype initial_replication_processed_bytes: long + :vartype initial_replication_processed_bytes: int :ivar initial_replication_transferred_bytes: The initial replication transferred bytes from source VM to azure for all selected disks on source VM. - :vartype initial_replication_transferred_bytes: long - :ivar initial_replication_progress_health: The initial replication progress health. Possible - values include: "None", "InProgress", "SlowProgress", "NoProgress". + :vartype initial_replication_transferred_bytes: int + :ivar initial_replication_progress_health: The initial replication progress health. Known + values are: "None", "InProgress", "SlowProgress", and "NoProgress". :vartype initial_replication_progress_health: str or ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth :ivar resync_progress_percentage: The resync progress percentage. This is calculated based on @@ -12138,21 +15406,21 @@ class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings): :vartype resync_progress_percentage: int :ivar resync_processed_bytes: The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM. - :vartype resync_processed_bytes: long + :vartype resync_processed_bytes: int :ivar resync_transferred_bytes: The resync transferred bytes from source VM to azure for all selected disks on source VM. - :vartype resync_transferred_bytes: long - :ivar resync_progress_health: The resync progress health. Possible values include: "None", - "InProgress", "SlowProgress", "NoProgress". + :vartype resync_transferred_bytes: int + :ivar resync_progress_health: The resync progress health. Known values are: "None", + "InProgress", "SlowProgress", and "NoProgress". :vartype resync_progress_health: str or ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth :ivar resync_required: A value indicating whether resync is required. :vartype resync_required: str - :ivar resync_state: The resync state. Possible values include: "None", - "PreparedForResynchronization", "StartedResynchronization". + :ivar resync_state: The resync state. Known values are: "None", "PreparedForResynchronization", + and "StartedResynchronization". :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState - :ivar agent_upgrade_state: The agent auto upgrade state. Possible values include: "None", - "Started", "Completed", "Commit". + :ivar agent_upgrade_state: The agent auto upgrade state. Known values are: "None", "Started", + "Completed", and "Commit". :vartype agent_upgrade_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.MobilityAgentUpgradeState :ivar last_agent_upgrade_type: The last agent upgrade type. @@ -12162,8 +15430,8 @@ class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings): :ivar agent_upgrade_attempt_to_version: The agent version to which last agent upgrade was attempted. :vartype agent_upgrade_attempt_to_version: str - :param protected_disks: The list of protected disks. - :type protected_disks: + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmProtectedDiskDetails] :ivar is_last_upgrade_successful: A value indicating whether last agent upgrade was successful or not. @@ -12171,116 +15439,127 @@ class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings): :ivar is_agent_registration_successful_after_failover: A value indicating whether agent registration was successful after failover. :vartype is_agent_registration_successful_after_failover: bool - :param mobility_agent_details: The mobility agent information. - :type mobility_agent_details: + :ivar mobility_agent_details: The mobility agent information. + :vartype mobility_agent_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmMobilityAgentDetails - :param last_agent_upgrade_error_details: The last agent upgrade error information. - :type last_agent_upgrade_error_details: + :ivar last_agent_upgrade_error_details: The last agent upgrade error information. + :vartype last_agent_upgrade_error_details: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmLastAgentUpgradeErrorDetails] - :param agent_upgrade_blocking_error_details: The agent upgrade blocking error information. - :type agent_upgrade_blocking_error_details: + :ivar agent_upgrade_blocking_error_details: The agent upgrade blocking error information. + :vartype agent_upgrade_blocking_error_details: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAgentUpgradeBlockingErrorDetails] - :param vm_nics: The network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicDetails] - :param discovered_vm_details: The discovered VM details. - :type discovered_vm_details: + :ivar vm_nics: The network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicDetails] + :ivar discovered_vm_details: The discovered VM details. + :vartype discovered_vm_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiscoveredProtectedVmDetails """ _validation = { - 'instance_type': {'required': True}, - 'internal_identifier': {'readonly': True}, - 'fabric_discovery_machine_id': {'readonly': True}, - 'multi_vm_group_name': {'readonly': True}, - 'discovery_type': {'readonly': True}, - 'process_server_id': {'readonly': True}, - 'processor_core_count': {'readonly': True}, - 'allocated_memory_in_mb': {'readonly': True}, - 'process_server_name': {'readonly': True}, - 'run_as_account_id': {'readonly': True}, - 'os_type': {'readonly': True}, - 'firmware_type': {'readonly': True}, - 'primary_nic_ip_address': {'readonly': True}, - 'target_generation': {'readonly': True}, - 'failover_recovery_point_id': {'readonly': True}, - 'last_recovery_point_received': {'readonly': True}, - 'last_rpo_in_seconds': {'readonly': True}, - 'last_rpo_calculated_time': {'readonly': True}, - 'last_recovery_point_id': {'readonly': True}, - 'initial_replication_progress_percentage': {'readonly': True}, - 'initial_replication_processed_bytes': {'readonly': True}, - 'initial_replication_transferred_bytes': {'readonly': True}, - 'initial_replication_progress_health': {'readonly': True}, - 'resync_progress_percentage': {'readonly': True}, - 'resync_processed_bytes': {'readonly': True}, - 'resync_transferred_bytes': {'readonly': True}, - 'resync_progress_health': {'readonly': True}, - 'resync_required': {'readonly': True}, - 'resync_state': {'readonly': True}, - 'agent_upgrade_state': {'readonly': True}, - 'last_agent_upgrade_type': {'readonly': True}, - 'agent_upgrade_job_id': {'readonly': True}, - 'agent_upgrade_attempt_to_version': {'readonly': True}, - 'is_last_upgrade_successful': {'readonly': True}, - 'is_agent_registration_successful_after_failover': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'internal_identifier': {'key': 'internalIdentifier', 'type': 'str'}, - 'fabric_discovery_machine_id': {'key': 'fabricDiscoveryMachineId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'processor_core_count': {'key': 'processorCoreCount', 'type': 'int'}, - 'allocated_memory_in_mb': {'key': 'allocatedMemoryInMB', 'type': 'float'}, - 'process_server_name': {'key': 'processServerName', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'firmware_type': {'key': 'firmwareType', 'type': 'str'}, - 'primary_nic_ip_address': {'key': 'primaryNicIpAddress', 'type': 'str'}, - 'target_generation': {'key': 'targetGeneration', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_location': {'key': 'targetLocation', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'test_network_id': {'key': 'testNetworkId', 'type': 'str'}, - 'failover_recovery_point_id': {'key': 'failoverRecoveryPointId', 'type': 'str'}, - 'last_recovery_point_received': {'key': 'lastRecoveryPointReceived', 'type': 'iso-8601'}, - 'last_rpo_in_seconds': {'key': 'lastRpoInSeconds', 'type': 'long'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'last_recovery_point_id': {'key': 'lastRecoveryPointId', 'type': 'str'}, - 'initial_replication_progress_percentage': {'key': 'initialReplicationProgressPercentage', 'type': 'int'}, - 'initial_replication_processed_bytes': {'key': 'initialReplicationProcessedBytes', 'type': 'long'}, - 'initial_replication_transferred_bytes': {'key': 'initialReplicationTransferredBytes', 'type': 'long'}, - 'initial_replication_progress_health': {'key': 'initialReplicationProgressHealth', 'type': 'str'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'resync_processed_bytes': {'key': 'resyncProcessedBytes', 'type': 'long'}, - 'resync_transferred_bytes': {'key': 'resyncTransferredBytes', 'type': 'long'}, - 'resync_progress_health': {'key': 'resyncProgressHealth', 'type': 'str'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_state': {'key': 'resyncState', 'type': 'str'}, - 'agent_upgrade_state': {'key': 'agentUpgradeState', 'type': 'str'}, - 'last_agent_upgrade_type': {'key': 'lastAgentUpgradeType', 'type': 'str'}, - 'agent_upgrade_job_id': {'key': 'agentUpgradeJobId', 'type': 'str'}, - 'agent_upgrade_attempt_to_version': {'key': 'agentUpgradeAttemptToVersion', 'type': 'str'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[InMageRcmProtectedDiskDetails]'}, - 'is_last_upgrade_successful': {'key': 'isLastUpgradeSuccessful', 'type': 'str'}, - 'is_agent_registration_successful_after_failover': {'key': 'isAgentRegistrationSuccessfulAfterFailover', 'type': 'bool'}, - 'mobility_agent_details': {'key': 'mobilityAgentDetails', 'type': 'InMageRcmMobilityAgentDetails'}, - 'last_agent_upgrade_error_details': {'key': 'lastAgentUpgradeErrorDetails', 'type': '[InMageRcmLastAgentUpgradeErrorDetails]'}, - 'agent_upgrade_blocking_error_details': {'key': 'agentUpgradeBlockingErrorDetails', 'type': '[InMageRcmAgentUpgradeBlockingErrorDetails]'}, - 'vm_nics': {'key': 'vmNics', 'type': '[InMageRcmNicDetails]'}, - 'discovered_vm_details': {'key': 'discoveredVmDetails', 'type': 'InMageRcmDiscoveredProtectedVmDetails'}, - } - - def __init__( + "instance_type": {"required": True}, + "internal_identifier": {"readonly": True}, + "fabric_discovery_machine_id": {"readonly": True}, + "multi_vm_group_name": {"readonly": True}, + "discovery_type": {"readonly": True}, + "process_server_id": {"readonly": True}, + "processor_core_count": {"readonly": True}, + "allocated_memory_in_mb": {"readonly": True}, + "process_server_name": {"readonly": True}, + "run_as_account_id": {"readonly": True}, + "os_type": {"readonly": True}, + "firmware_type": {"readonly": True}, + "primary_nic_ip_address": {"readonly": True}, + "target_generation": {"readonly": True}, + "storage_account_id": {"readonly": True}, + "failover_recovery_point_id": {"readonly": True}, + "last_recovery_point_received": {"readonly": True}, + "last_rpo_in_seconds": {"readonly": True}, + "last_rpo_calculated_time": {"readonly": True}, + "last_recovery_point_id": {"readonly": True}, + "initial_replication_progress_percentage": {"readonly": True}, + "initial_replication_processed_bytes": {"readonly": True}, + "initial_replication_transferred_bytes": {"readonly": True}, + "initial_replication_progress_health": {"readonly": True}, + "resync_progress_percentage": {"readonly": True}, + "resync_processed_bytes": {"readonly": True}, + "resync_transferred_bytes": {"readonly": True}, + "resync_progress_health": {"readonly": True}, + "resync_required": {"readonly": True}, + "resync_state": {"readonly": True}, + "agent_upgrade_state": {"readonly": True}, + "last_agent_upgrade_type": {"readonly": True}, + "agent_upgrade_job_id": {"readonly": True}, + "agent_upgrade_attempt_to_version": {"readonly": True}, + "is_last_upgrade_successful": {"readonly": True}, + "is_agent_registration_successful_after_failover": {"readonly": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "internal_identifier": {"key": "internalIdentifier", "type": "str"}, + "fabric_discovery_machine_id": {"key": "fabricDiscoveryMachineId", "type": "str"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "discovery_type": {"key": "discoveryType", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "processor_core_count": {"key": "processorCoreCount", "type": "int"}, + "allocated_memory_in_mb": {"key": "allocatedMemoryInMB", "type": "float"}, + "process_server_name": {"key": "processServerName", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "firmware_type": {"key": "firmwareType", "type": "str"}, + "primary_nic_ip_address": {"key": "primaryNicIpAddress", "type": "str"}, + "target_generation": {"key": "targetGeneration", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "target_vm_name": {"key": "targetVmName", "type": "str"}, + "target_vm_size": {"key": "targetVmSize", "type": "str"}, + "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, + "target_location": {"key": "targetLocation", "type": "str"}, + "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, + "target_network_id": {"key": "targetNetworkId", "type": "str"}, + "test_network_id": {"key": "testNetworkId", "type": "str"}, + "failover_recovery_point_id": {"key": "failoverRecoveryPointId", "type": "str"}, + "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, + "last_rpo_in_seconds": {"key": "lastRpoInSeconds", "type": "int"}, + "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, + "last_recovery_point_id": {"key": "lastRecoveryPointId", "type": "str"}, + "initial_replication_progress_percentage": {"key": "initialReplicationProgressPercentage", "type": "int"}, + "initial_replication_processed_bytes": {"key": "initialReplicationProcessedBytes", "type": "int"}, + "initial_replication_transferred_bytes": {"key": "initialReplicationTransferredBytes", "type": "int"}, + "initial_replication_progress_health": {"key": "initialReplicationProgressHealth", "type": "str"}, + "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, + "resync_processed_bytes": {"key": "resyncProcessedBytes", "type": "int"}, + "resync_transferred_bytes": {"key": "resyncTransferredBytes", "type": "int"}, + "resync_progress_health": {"key": "resyncProgressHealth", "type": "str"}, + "resync_required": {"key": "resyncRequired", "type": "str"}, + "resync_state": {"key": "resyncState", "type": "str"}, + "agent_upgrade_state": {"key": "agentUpgradeState", "type": "str"}, + "last_agent_upgrade_type": {"key": "lastAgentUpgradeType", "type": "str"}, + "agent_upgrade_job_id": {"key": "agentUpgradeJobId", "type": "str"}, + "agent_upgrade_attempt_to_version": {"key": "agentUpgradeAttemptToVersion", "type": "str"}, + "protected_disks": {"key": "protectedDisks", "type": "[InMageRcmProtectedDiskDetails]"}, + "is_last_upgrade_successful": {"key": "isLastUpgradeSuccessful", "type": "str"}, + "is_agent_registration_successful_after_failover": { + "key": "isAgentRegistrationSuccessfulAfterFailover", + "type": "bool", + }, + "mobility_agent_details": {"key": "mobilityAgentDetails", "type": "InMageRcmMobilityAgentDetails"}, + "last_agent_upgrade_error_details": { + "key": "lastAgentUpgradeErrorDetails", + "type": "[InMageRcmLastAgentUpgradeErrorDetails]", + }, + "agent_upgrade_blocking_error_details": { + "key": "agentUpgradeBlockingErrorDetails", + "type": "[InMageRcmAgentUpgradeBlockingErrorDetails]", + }, + "vm_nics": {"key": "vmNics", "type": "[InMageRcmNicDetails]"}, + "discovered_vm_details": {"key": "discoveredVmDetails", "type": "InMageRcmDiscoveredProtectedVmDetails"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, license_type: Optional[str] = None, @@ -12294,16 +15573,60 @@ def __init__( target_boot_diagnostics_storage_account_id: Optional[str] = None, target_network_id: Optional[str] = None, test_network_id: Optional[str] = None, - protected_disks: Optional[List["InMageRcmProtectedDiskDetails"]] = None, - mobility_agent_details: Optional["InMageRcmMobilityAgentDetails"] = None, - last_agent_upgrade_error_details: Optional[List["InMageRcmLastAgentUpgradeErrorDetails"]] = None, - agent_upgrade_blocking_error_details: Optional[List["InMageRcmAgentUpgradeBlockingErrorDetails"]] = None, - vm_nics: Optional[List["InMageRcmNicDetails"]] = None, - discovered_vm_details: Optional["InMageRcmDiscoveredProtectedVmDetails"] = None, - **kwargs - ): - super(InMageRcmReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + protected_disks: Optional[List["_models.InMageRcmProtectedDiskDetails"]] = None, + mobility_agent_details: Optional["_models.InMageRcmMobilityAgentDetails"] = None, + last_agent_upgrade_error_details: Optional[List["_models.InMageRcmLastAgentUpgradeErrorDetails"]] = None, + agent_upgrade_blocking_error_details: Optional[ + List["_models.InMageRcmAgentUpgradeBlockingErrorDetails"] + ] = None, + vm_nics: Optional[List["_models.InMageRcmNicDetails"]] = None, + discovered_vm_details: Optional["_models.InMageRcmDiscoveredProtectedVmDetails"] = None, + **kwargs + ): + """ + :keyword license_type: License Type of the VM to be used. + :paramtype license_type: str + :keyword target_vm_name: Target VM name. + :paramtype target_vm_name: str + :keyword target_vm_size: The target VM size. + :paramtype target_vm_size: str + :keyword target_resource_group_id: The target resource group Id. + :paramtype target_resource_group_id: str + :keyword target_location: The target location. + :paramtype target_location: str + :keyword target_availability_set_id: The target availability set Id. + :paramtype target_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_proximity_placement_group_id: The target proximity placement group Id. + :paramtype target_proximity_placement_group_id: str + :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage + account ARM Id. + :paramtype target_boot_diagnostics_storage_account_id: str + :keyword target_network_id: The target network Id. + :paramtype target_network_id: str + :keyword test_network_id: The test network Id. + :paramtype test_network_id: str + :keyword protected_disks: The list of protected disks. + :paramtype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmProtectedDiskDetails] + :keyword mobility_agent_details: The mobility agent information. + :paramtype mobility_agent_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmMobilityAgentDetails + :keyword last_agent_upgrade_error_details: The last agent upgrade error information. + :paramtype last_agent_upgrade_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmLastAgentUpgradeErrorDetails] + :keyword agent_upgrade_blocking_error_details: The agent upgrade blocking error information. + :paramtype agent_upgrade_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAgentUpgradeBlockingErrorDetails] + :keyword vm_nics: The network details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicDetails] + :keyword discovered_vm_details: The discovered VM details. + :paramtype discovered_vm_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiscoveredProtectedVmDetails + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.internal_identifier = None self.fabric_discovery_machine_id = None self.multi_vm_group_name = None @@ -12318,6 +15641,7 @@ def __init__( self.primary_nic_ip_address = None self.target_generation = None self.license_type = license_type + self.storage_account_id = None self.target_vm_name = target_vm_name self.target_vm_size = target_vm_size self.target_resource_group_id = target_resource_group_id @@ -12362,31 +15686,31 @@ class InMageRcmReprotectInput(ReverseReplicationProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param reprotect_agent_id: Required. The reprotect agent Id. - :type reprotect_agent_id: str - :param datastore_name: Required. The target datastore name. - :type datastore_name: str - :param log_storage_account_id: Required. The log storage account ARM Id. - :type log_storage_account_id: str - :param policy_id: The Policy Id. - :type policy_id: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar reprotect_agent_id: The reprotect agent Id. Required. + :vartype reprotect_agent_id: str + :ivar datastore_name: The target datastore name. Required. + :vartype datastore_name: str + :ivar log_storage_account_id: The log storage account ARM Id. Required. + :vartype log_storage_account_id: str + :ivar policy_id: The Policy Id. + :vartype policy_id: str """ _validation = { - 'instance_type': {'required': True}, - 'reprotect_agent_id': {'required': True}, - 'datastore_name': {'required': True}, - 'log_storage_account_id': {'required': True}, + "instance_type": {"required": True}, + "reprotect_agent_id": {"required": True}, + "datastore_name": {"required": True}, + "log_storage_account_id": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'reprotect_agent_id': {'key': 'reprotectAgentId', 'type': 'str'}, - 'datastore_name': {'key': 'datastoreName', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "reprotect_agent_id": {"key": "reprotectAgentId", "type": "str"}, + "datastore_name": {"key": "datastoreName", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, } def __init__( @@ -12398,33 +15722,43 @@ def __init__( policy_id: Optional[str] = None, **kwargs ): - super(InMageRcmReprotectInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + """ + :keyword reprotect_agent_id: The reprotect agent Id. Required. + :paramtype reprotect_agent_id: str + :keyword datastore_name: The target datastore name. Required. + :paramtype datastore_name: str + :keyword log_storage_account_id: The log storage account ARM Id. Required. + :paramtype log_storage_account_id: str + :keyword policy_id: The Policy Id. + :paramtype policy_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.reprotect_agent_id = reprotect_agent_id self.datastore_name = datastore_name self.log_storage_account_id = log_storage_account_id self.policy_id = policy_id -class InMageRcmSyncDetails(msrest.serialization.Model): +class InMageRcmSyncDetails(_serialization.Model): """InMageRcm disk level sync details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar progress_health: The progress health. Possible values include: "None", "InProgress", - "SlowProgress", "NoProgress", "Queued". + :ivar progress_health: The progress health. Known values are: "None", "InProgress", + "SlowProgress", "NoProgress", and "Queued". :vartype progress_health: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskReplicationProgressHealth :ivar transferred_bytes: The transferred bytes from source VM to azure for the disk. - :vartype transferred_bytes: long + :vartype transferred_bytes: int :ivar last15_minutes_transferred_bytes: The bytes transferred in last 15 minutes from source VM to azure. - :vartype last15_minutes_transferred_bytes: long + :vartype last15_minutes_transferred_bytes: int :ivar last_data_transfer_time_utc: The time of the last data transfer from source VM to azure. :vartype last_data_transfer_time_utc: str :ivar processed_bytes: The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. - :vartype processed_bytes: long + :vartype processed_bytes: int :ivar start_time: The start time. :vartype start_time: str :ivar last_refresh_time: The last refresh time. @@ -12435,32 +15769,30 @@ class InMageRcmSyncDetails(msrest.serialization.Model): """ _validation = { - 'progress_health': {'readonly': True}, - 'transferred_bytes': {'readonly': True}, - 'last15_minutes_transferred_bytes': {'readonly': True}, - 'last_data_transfer_time_utc': {'readonly': True}, - 'processed_bytes': {'readonly': True}, - 'start_time': {'readonly': True}, - 'last_refresh_time': {'readonly': True}, - 'progress_percentage': {'readonly': True}, + "progress_health": {"readonly": True}, + "transferred_bytes": {"readonly": True}, + "last15_minutes_transferred_bytes": {"readonly": True}, + "last_data_transfer_time_utc": {"readonly": True}, + "processed_bytes": {"readonly": True}, + "start_time": {"readonly": True}, + "last_refresh_time": {"readonly": True}, + "progress_percentage": {"readonly": True}, } _attribute_map = { - 'progress_health': {'key': 'progressHealth', 'type': 'str'}, - 'transferred_bytes': {'key': 'transferredBytes', 'type': 'long'}, - 'last15_minutes_transferred_bytes': {'key': 'last15MinutesTransferredBytes', 'type': 'long'}, - 'last_data_transfer_time_utc': {'key': 'lastDataTransferTimeUtc', 'type': 'str'}, - 'processed_bytes': {'key': 'processedBytes', 'type': 'long'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'last_refresh_time': {'key': 'lastRefreshTime', 'type': 'str'}, - 'progress_percentage': {'key': 'progressPercentage', 'type': 'int'}, + "progress_health": {"key": "progressHealth", "type": "str"}, + "transferred_bytes": {"key": "transferredBytes", "type": "int"}, + "last15_minutes_transferred_bytes": {"key": "last15MinutesTransferredBytes", "type": "int"}, + "last_data_transfer_time_utc": {"key": "lastDataTransferTimeUtc", "type": "str"}, + "processed_bytes": {"key": "processedBytes", "type": "int"}, + "start_time": {"key": "startTime", "type": "str"}, + "last_refresh_time": {"key": "lastRefreshTime", "type": "str"}, + "progress_percentage": {"key": "progressPercentage", "type": "int"}, } - def __init__( - self, - **kwargs - ): - super(InMageRcmSyncDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.progress_health = None self.transferred_bytes = None self.last15_minutes_transferred_bytes = None @@ -12476,34 +15808,35 @@ class InMageRcmTestFailoverInput(TestFailoverProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param network_id: The test network Id. - :type network_id: str - :param recovery_point_id: The recovery point id to be passed to test failover to a particular + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar network_id: The test network Id. + :vartype network_id: str + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'network_id': {'key': 'networkId', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "network_id": {"key": "networkId", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } - def __init__( - self, - *, - network_id: Optional[str] = None, - recovery_point_id: Optional[str] = None, - **kwargs - ): - super(InMageRcmTestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + def __init__(self, *, network_id: Optional[str] = None, recovery_point_id: Optional[str] = None, **kwargs): + """ + :keyword network_id: The test network Id. + :paramtype network_id: str + :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.network_id = network_id self.recovery_point_id = recovery_point_id @@ -12513,99 +15846,97 @@ class InMageRcmUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param perform_shutdown: Required. A value indicating whether VM is to be shutdown. - :type perform_shutdown: str - :param recovery_point_id: The recovery point id to be passed to failover to a particular + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar perform_shutdown: A value indicating whether VM is to be shutdown. Required. + :vartype perform_shutdown: str + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, - 'perform_shutdown': {'required': True}, + "instance_type": {"required": True}, + "perform_shutdown": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'perform_shutdown': {'key': 'performShutdown', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "perform_shutdown": {"key": "performShutdown", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } - def __init__( - self, - *, - perform_shutdown: str, - recovery_point_id: Optional[str] = None, - **kwargs - ): - super(InMageRcmUnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + def __init__(self, *, perform_shutdown: str, recovery_point_id: Optional[str] = None, **kwargs): + """ + :keyword perform_shutdown: A value indicating whether VM is to be shutdown. Required. + :paramtype perform_shutdown: str + :keyword recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.perform_shutdown = perform_shutdown self.recovery_point_id = recovery_point_id -class UpdateApplianceForReplicationProtectedItemProviderSpecificInput(msrest.serialization.Model): +class UpdateApplianceForReplicationProtectedItemProviderSpecificInput(_serialization.Model): """Update replication protected item provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: InMageRcmUpdateApplianceForReplicationProtectedItemInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InMageRcmUpdateApplianceForReplicationProtectedItemInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'InMageRcm': 'InMageRcmUpdateApplianceForReplicationProtectedItemInput'} - } + _subtype_map = {"instance_type": {"InMageRcm": "InMageRcmUpdateApplianceForReplicationProtectedItemInput"}} - def __init__( - self, - **kwargs - ): - super(UpdateApplianceForReplicationProtectedItemProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class InMageRcmUpdateApplianceForReplicationProtectedItemInput(UpdateApplianceForReplicationProtectedItemProviderSpecificInput): +class InMageRcmUpdateApplianceForReplicationProtectedItemInput( + UpdateApplianceForReplicationProtectedItemProviderSpecificInput +): """InMageRcm provider specific input to update appliance for replication protected item. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param run_as_account_id: The run as account Id. - :type run_as_account_id: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar run_as_account_id: The run as account Id. + :vartype run_as_account_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, } - def __init__( - self, - *, - run_as_account_id: Optional[str] = None, - **kwargs - ): - super(InMageRcmUpdateApplianceForReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + def __init__(self, *, run_as_account_id: Optional[str] = None, **kwargs): + """ + :keyword run_as_account_id: The run as account Id. + :paramtype run_as_account_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.run_as_account_id = run_as_account_id @@ -12614,84 +15945,86 @@ class InMageRcmUpdateContainerMappingInput(ReplicationProviderSpecificUpdateCont All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param enable_agent_auto_upgrade: Required. A value indicating whether agent auto upgrade has - to be enabled. - :type enable_agent_auto_upgrade: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar enable_agent_auto_upgrade: A value indicating whether agent auto upgrade has to be + enabled. Required. + :vartype enable_agent_auto_upgrade: str """ _validation = { - 'instance_type': {'required': True}, - 'enable_agent_auto_upgrade': {'required': True}, + "instance_type": {"required": True}, + "enable_agent_auto_upgrade": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'enable_agent_auto_upgrade': {'key': 'enableAgentAutoUpgrade', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "enable_agent_auto_upgrade": {"key": "enableAgentAutoUpgrade", "type": "str"}, } - def __init__( - self, - *, - enable_agent_auto_upgrade: str, - **kwargs - ): - super(InMageRcmUpdateContainerMappingInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + def __init__(self, *, enable_agent_auto_upgrade: str, **kwargs): + """ + :keyword enable_agent_auto_upgrade: A value indicating whether agent auto upgrade has to be + enabled. Required. + :paramtype enable_agent_auto_upgrade: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.enable_agent_auto_upgrade = enable_agent_auto_upgrade -class InMageRcmUpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProviderInput): +class InMageRcmUpdateReplicationProtectedItemInput( + UpdateReplicationProtectedItemProviderInput +): # pylint: disable=too-many-instance-attributes """InMageRcm provider specific input to update replication protected item. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param target_vm_name: The target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_resource_group_id: The target resource group ARM Id. - :type target_resource_group_id: str - :param target_availability_set_id: The target availability set ARM Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar target_vm_name: The target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_resource_group_id: The target resource group ARM Id. + :vartype target_resource_group_id: str + :ivar target_availability_set_id: The target availability set ARM Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param target_network_id: The target network ARM Id. - :type target_network_id: str - :param test_network_id: The test network ARM Id. - :type test_network_id: str - :param vm_nics: The list of NIC details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicInput] - :param license_type: The license type. Possible values include: "NotSpecified", - "NoLicenseType", "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :vartype target_boot_diagnostics_storage_account_id: str + :ivar target_network_id: The target network ARM Id. + :vartype target_network_id: str + :ivar test_network_id: The test network ARM Id. + :vartype test_network_id: str + :ivar vm_nics: The list of NIC details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicInput] + :ivar license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'test_network_id': {'key': 'testNetworkId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[InMageRcmNicInput]'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "target_vm_name": {"key": "targetVmName", "type": "str"}, + "target_vm_size": {"key": "targetVmSize", "type": "str"}, + "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, + "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, + "target_network_id": {"key": "targetNetworkId", "type": "str"}, + "test_network_id": {"key": "testNetworkId", "type": "str"}, + "vm_nics": {"key": "vmNics", "type": "[InMageRcmNicInput]"}, + "license_type": {"key": "licenseType", "type": "str"}, } def __init__( @@ -12706,12 +16039,38 @@ def __init__( target_boot_diagnostics_storage_account_id: Optional[str] = None, target_network_id: Optional[str] = None, test_network_id: Optional[str] = None, - vm_nics: Optional[List["InMageRcmNicInput"]] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, - **kwargs - ): - super(InMageRcmUpdateReplicationProtectedItemInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + vm_nics: Optional[List["_models.InMageRcmNicInput"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + **kwargs + ): + """ + :keyword target_vm_name: The target VM name. + :paramtype target_vm_name: str + :keyword target_vm_size: The target VM size. + :paramtype target_vm_size: str + :keyword target_resource_group_id: The target resource group ARM Id. + :paramtype target_resource_group_id: str + :keyword target_availability_set_id: The target availability set ARM Id. + :paramtype target_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_proximity_placement_group_id: The target proximity placement group Id. + :paramtype target_proximity_placement_group_id: str + :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage + account ARM Id. + :paramtype target_boot_diagnostics_storage_account_id: str + :keyword target_network_id: The target network ARM Id. + :paramtype target_network_id: str + :keyword test_network_id: The test network ARM Id. + :paramtype test_network_id: str + :keyword vm_nics: The list of NIC details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicInput] + :keyword license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.target_vm_name = target_vm_name self.target_vm_size = target_vm_size self.target_resource_group_id = target_resource_group_id @@ -12725,170 +16084,171 @@ def __init__( self.license_type = license_type -class InMageReplicationDetails(ReplicationProviderSpecificSettings): +class InMageReplicationDetails(ReplicationProviderSpecificSettings): # pylint: disable=too-many-instance-attributes """InMage provider specific settings. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param active_site_type: The active location of the VM. If the VM is being protected from - Azure, this field will take values from { Azure, OnPrem }. If the VM is being protected between - two data-centers, this field will be OnPrem always. - :type active_site_type: str - :param source_vm_cpu_count: The CPU count of the VM on the primary side. - :type source_vm_cpu_count: int - :param source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :type source_vm_ram_size_in_mb: int - :param os_details: The OS details. - :type os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDiskDetails - :param protection_stage: The protection stage. - :type protection_stage: str - :param vm_id: The virtual machine Id. - :type vm_id: str - :param vm_protection_state: The protection state for the vm. - :type vm_protection_state: str - :param vm_protection_state_description: The protection state description for the vm. - :type vm_protection_state_description: str - :param resync_details: The resync details of the machine. - :type resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :param retention_window_start: The retention window start time. - :type retention_window_start: ~datetime.datetime - :param retention_window_end: The retention window end time. - :type retention_window_end: ~datetime.datetime - :param compressed_data_rate_in_mb: The compressed data change rate in MB. - :type compressed_data_rate_in_mb: float - :param uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. - :type uncompressed_data_rate_in_mb: float - :param rpo_in_seconds: The RPO in seconds. - :type rpo_in_seconds: long - :param protected_disks: The list of protected disks. - :type protected_disks: + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar active_site_type: The active location of the VM. If the VM is being protected from Azure, + this field will take values from { Azure, OnPrem }. If the VM is being protected between two + data-centers, this field will be OnPrem always. + :vartype active_site_type: str + :ivar source_vm_cpu_count: The CPU count of the VM on the primary side. + :vartype source_vm_cpu_count: int + :ivar source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. + :vartype source_vm_ram_size_in_mb: int + :ivar os_details: The OS details. + :vartype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDiskDetails + :ivar protection_stage: The protection stage. + :vartype protection_stage: str + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar resync_details: The resync details of the machine. + :vartype resync_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :ivar retention_window_start: The retention window start time. + :vartype retention_window_start: ~datetime.datetime + :ivar retention_window_end: The retention window end time. + :vartype retention_window_end: ~datetime.datetime + :ivar compressed_data_rate_in_mb: The compressed data change rate in MB. + :vartype compressed_data_rate_in_mb: float + :ivar uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. + :vartype uncompressed_data_rate_in_mb: float + :ivar rpo_in_seconds: The RPO in seconds. + :vartype rpo_in_seconds: int + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageProtectedDiskDetails] - :param ip_address: The source IP address. - :type ip_address: str - :param last_heartbeat: The last heartbeat received from the source server. - :type last_heartbeat: ~datetime.datetime - :param process_server_id: The process server Id. - :type process_server_id: str - :param master_target_id: The master target Id. - :type master_target_id: str - :param consistency_points: The collection of Consistency points. - :type consistency_points: dict[str, ~datetime.datetime] - :param disk_resized: A value indicating whether any disk is resized for this VM. - :type disk_resized: str - :param reboot_after_update_status: A value indicating whether the source server requires a + :ivar ip_address: The source IP address. + :vartype ip_address: str + :ivar last_heartbeat: The last heartbeat received from the source server. + :vartype last_heartbeat: ~datetime.datetime + :ivar process_server_id: The process server Id. + :vartype process_server_id: str + :ivar master_target_id: The master target Id. + :vartype master_target_id: str + :ivar consistency_points: The collection of Consistency points. + :vartype consistency_points: dict[str, ~datetime.datetime] + :ivar disk_resized: A value indicating whether any disk is resized for this VM. + :vartype disk_resized: str + :ivar reboot_after_update_status: A value indicating whether the source server requires a restart after update. - :type reboot_after_update_status: str - :param multi_vm_group_id: The multi vm group Id, if any. - :type multi_vm_group_id: str - :param multi_vm_group_name: The multi vm group name, if any. - :type multi_vm_group_name: str - :param multi_vm_sync_status: A value indicating whether the multi vm sync is enabled or + :vartype reboot_after_update_status: str + :ivar multi_vm_group_id: The multi vm group Id, if any. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi vm group name, if any. + :vartype multi_vm_group_name: str + :ivar multi_vm_sync_status: A value indicating whether the multi vm sync is enabled or disabled. - :type multi_vm_sync_status: str - :param agent_details: The agent details. - :type agent_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageAgentDetails - :param v_center_infrastructure_id: The vCenter infrastructure Id. - :type v_center_infrastructure_id: str - :param infrastructure_vm_id: The infrastructure VM Id. - :type infrastructure_vm_id: str - :param vm_nics: The PE Network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :param discovery_type: A value indicating the discovery type of the machine. - :type discovery_type: str - :param azure_storage_account_id: A value indicating the underlying Azure storage account. If - the VM is not running in Azure, this value shall be set to null. - :type azure_storage_account_id: str - :param datastores: The datastores of the on-premise machine Value can be list of strings that + :vartype multi_vm_sync_status: str + :ivar agent_details: The agent details. + :vartype agent_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageAgentDetails + :ivar v_center_infrastructure_id: The vCenter infrastructure Id. + :vartype v_center_infrastructure_id: str + :ivar infrastructure_vm_id: The infrastructure VM Id. + :vartype infrastructure_vm_id: str + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar discovery_type: A value indicating the discovery type of the machine. + :vartype discovery_type: str + :ivar azure_storage_account_id: A value indicating the underlying Azure storage account. If the + VM is not running in Azure, this value shall be set to null. + :vartype azure_storage_account_id: str + :ivar datastores: The datastores of the on-premise machine Value can be list of strings that contain datastore names. - :type datastores: list[str] - :param validation_errors: The validation errors of the on-premise machine Value can be list of + :vartype datastores: list[str] + :ivar validation_errors: The validation errors of the on-premise machine Value can be list of validation errors. - :type validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param last_rpo_calculated_time: The last RPO calculated time. - :type last_rpo_calculated_time: ~datetime.datetime - :param last_update_received_time: The last update time received from on-prem components. - :type last_update_received_time: ~datetime.datetime - :param replica_id: The replica id of the protected item. - :type replica_id: str - :param os_version: The OS Version of the protected item. - :type os_version: str - :param is_additional_stats_available: A value indicating whether additional IR stats are + :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar last_update_received_time: The last update time received from on-prem components. + :vartype last_update_received_time: ~datetime.datetime + :ivar replica_id: The replica id of the protected item. + :vartype replica_id: str + :ivar os_version: The OS Version of the protected item. + :vartype os_version: str + :ivar is_additional_stats_available: A value indicating whether additional IR stats are available or not. - :type is_additional_stats_available: bool - :param total_data_transferred: The total transferred data in bytes. - :type total_data_transferred: long - :param total_progress_health: The progress health. - :type total_progress_health: str - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'active_site_type': {'key': 'activeSiteType', 'type': 'str'}, - 'source_vm_cpu_count': {'key': 'sourceVmCpuCount', 'type': 'int'}, - 'source_vm_ram_size_in_mb': {'key': 'sourceVmRamSizeInMB', 'type': 'int'}, - 'os_details': {'key': 'osDetails', 'type': 'OSDiskDetails'}, - 'protection_stage': {'key': 'protectionStage', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'vm_protection_state': {'key': 'vmProtectionState', 'type': 'str'}, - 'vm_protection_state_description': {'key': 'vmProtectionStateDescription', 'type': 'str'}, - 'resync_details': {'key': 'resyncDetails', 'type': 'InitialReplicationDetails'}, - 'retention_window_start': {'key': 'retentionWindowStart', 'type': 'iso-8601'}, - 'retention_window_end': {'key': 'retentionWindowEnd', 'type': 'iso-8601'}, - 'compressed_data_rate_in_mb': {'key': 'compressedDataRateInMB', 'type': 'float'}, - 'uncompressed_data_rate_in_mb': {'key': 'uncompressedDataRateInMB', 'type': 'float'}, - 'rpo_in_seconds': {'key': 'rpoInSeconds', 'type': 'long'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[InMageProtectedDiskDetails]'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'consistency_points': {'key': 'consistencyPoints', 'type': '{iso-8601}'}, - 'disk_resized': {'key': 'diskResized', 'type': 'str'}, - 'reboot_after_update_status': {'key': 'rebootAfterUpdateStatus', 'type': 'str'}, - 'multi_vm_group_id': {'key': 'multiVmGroupId', 'type': 'str'}, - 'multi_vm_group_name': {'key': 'multiVmGroupName', 'type': 'str'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, - 'agent_details': {'key': 'agentDetails', 'type': 'InMageAgentDetails'}, - 'v_center_infrastructure_id': {'key': 'vCenterInfrastructureId', 'type': 'str'}, - 'infrastructure_vm_id': {'key': 'infrastructureVmId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicDetails]'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'azure_storage_account_id': {'key': 'azureStorageAccountId', 'type': 'str'}, - 'datastores': {'key': 'datastores', 'type': '[str]'}, - 'validation_errors': {'key': 'validationErrors', 'type': '[HealthError]'}, - 'last_rpo_calculated_time': {'key': 'lastRpoCalculatedTime', 'type': 'iso-8601'}, - 'last_update_received_time': {'key': 'lastUpdateReceivedTime', 'type': 'iso-8601'}, - 'replica_id': {'key': 'replicaId', 'type': 'str'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'is_additional_stats_available': {'key': 'isAdditionalStatsAvailable', 'type': 'bool'}, - 'total_data_transferred': {'key': 'totalDataTransferred', 'type': 'long'}, - 'total_progress_health': {'key': 'totalProgressHealth', 'type': 'str'}, - } - - def __init__( + :vartype is_additional_stats_available: bool + :ivar total_data_transferred: The total transferred data in bytes. + :vartype total_data_transferred: int + :ivar total_progress_health: The progress health. + :vartype total_progress_health: str + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "active_site_type": {"key": "activeSiteType", "type": "str"}, + "source_vm_cpu_count": {"key": "sourceVmCpuCount", "type": "int"}, + "source_vm_ram_size_in_mb": {"key": "sourceVmRamSizeInMB", "type": "int"}, + "os_details": {"key": "osDetails", "type": "OSDiskDetails"}, + "protection_stage": {"key": "protectionStage", "type": "str"}, + "vm_id": {"key": "vmId", "type": "str"}, + "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, + "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, + "resync_details": {"key": "resyncDetails", "type": "InitialReplicationDetails"}, + "retention_window_start": {"key": "retentionWindowStart", "type": "iso-8601"}, + "retention_window_end": {"key": "retentionWindowEnd", "type": "iso-8601"}, + "compressed_data_rate_in_mb": {"key": "compressedDataRateInMB", "type": "float"}, + "uncompressed_data_rate_in_mb": {"key": "uncompressedDataRateInMB", "type": "float"}, + "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, + "protected_disks": {"key": "protectedDisks", "type": "[InMageProtectedDiskDetails]"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "master_target_id": {"key": "masterTargetId", "type": "str"}, + "consistency_points": {"key": "consistencyPoints", "type": "{iso-8601}"}, + "disk_resized": {"key": "diskResized", "type": "str"}, + "reboot_after_update_status": {"key": "rebootAfterUpdateStatus", "type": "str"}, + "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, + "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, + "agent_details": {"key": "agentDetails", "type": "InMageAgentDetails"}, + "v_center_infrastructure_id": {"key": "vCenterInfrastructureId", "type": "str"}, + "infrastructure_vm_id": {"key": "infrastructureVmId", "type": "str"}, + "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, + "discovery_type": {"key": "discoveryType", "type": "str"}, + "azure_storage_account_id": {"key": "azureStorageAccountId", "type": "str"}, + "datastores": {"key": "datastores", "type": "[str]"}, + "validation_errors": {"key": "validationErrors", "type": "[HealthError]"}, + "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, + "last_update_received_time": {"key": "lastUpdateReceivedTime", "type": "iso-8601"}, + "replica_id": {"key": "replicaId", "type": "str"}, + "os_version": {"key": "osVersion", "type": "str"}, + "is_additional_stats_available": {"key": "isAdditionalStatsAvailable", "type": "bool"}, + "total_data_transferred": {"key": "totalDataTransferred", "type": "int"}, + "total_progress_health": {"key": "totalProgressHealth", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, active_site_type: Optional[str] = None, source_vm_cpu_count: Optional[int] = None, source_vm_ram_size_in_mb: Optional[int] = None, - os_details: Optional["OSDiskDetails"] = None, + os_details: Optional["_models.OSDiskDetails"] = None, protection_stage: Optional[str] = None, vm_id: Optional[str] = None, vm_protection_state: Optional[str] = None, vm_protection_state_description: Optional[str] = None, - resync_details: Optional["InitialReplicationDetails"] = None, + resync_details: Optional["_models.InitialReplicationDetails"] = None, retention_window_start: Optional[datetime.datetime] = None, retention_window_end: Optional[datetime.datetime] = None, compressed_data_rate_in_mb: Optional[float] = None, uncompressed_data_rate_in_mb: Optional[float] = None, rpo_in_seconds: Optional[int] = None, - protected_disks: Optional[List["InMageProtectedDiskDetails"]] = None, + protected_disks: Optional[List["_models.InMageProtectedDiskDetails"]] = None, ip_address: Optional[str] = None, last_heartbeat: Optional[datetime.datetime] = None, process_server_id: Optional[str] = None, @@ -12899,14 +16259,14 @@ def __init__( multi_vm_group_id: Optional[str] = None, multi_vm_group_name: Optional[str] = None, multi_vm_sync_status: Optional[str] = None, - agent_details: Optional["InMageAgentDetails"] = None, + agent_details: Optional["_models.InMageAgentDetails"] = None, v_center_infrastructure_id: Optional[str] = None, infrastructure_vm_id: Optional[str] = None, - vm_nics: Optional[List["VMNicDetails"]] = None, + vm_nics: Optional[List["_models.VMNicDetails"]] = None, discovery_type: Optional[str] = None, azure_storage_account_id: Optional[str] = None, datastores: Optional[List[str]] = None, - validation_errors: Optional[List["HealthError"]] = None, + validation_errors: Optional[List["_models.HealthError"]] = None, last_rpo_calculated_time: Optional[datetime.datetime] = None, last_update_received_time: Optional[datetime.datetime] = None, replica_id: Optional[str] = None, @@ -12916,8 +16276,100 @@ def __init__( total_progress_health: Optional[str] = None, **kwargs ): - super(InMageReplicationDetails, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str + """ + :keyword active_site_type: The active location of the VM. If the VM is being protected from + Azure, this field will take values from { Azure, OnPrem }. If the VM is being protected between + two data-centers, this field will be OnPrem always. + :paramtype active_site_type: str + :keyword source_vm_cpu_count: The CPU count of the VM on the primary side. + :paramtype source_vm_cpu_count: int + :keyword source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. + :paramtype source_vm_ram_size_in_mb: int + :keyword os_details: The OS details. + :paramtype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDiskDetails + :keyword protection_stage: The protection stage. + :paramtype protection_stage: str + :keyword vm_id: The virtual machine Id. + :paramtype vm_id: str + :keyword vm_protection_state: The protection state for the vm. + :paramtype vm_protection_state: str + :keyword vm_protection_state_description: The protection state description for the vm. + :paramtype vm_protection_state_description: str + :keyword resync_details: The resync details of the machine. + :paramtype resync_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :keyword retention_window_start: The retention window start time. + :paramtype retention_window_start: ~datetime.datetime + :keyword retention_window_end: The retention window end time. + :paramtype retention_window_end: ~datetime.datetime + :keyword compressed_data_rate_in_mb: The compressed data change rate in MB. + :paramtype compressed_data_rate_in_mb: float + :keyword uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. + :paramtype uncompressed_data_rate_in_mb: float + :keyword rpo_in_seconds: The RPO in seconds. + :paramtype rpo_in_seconds: int + :keyword protected_disks: The list of protected disks. + :paramtype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageProtectedDiskDetails] + :keyword ip_address: The source IP address. + :paramtype ip_address: str + :keyword last_heartbeat: The last heartbeat received from the source server. + :paramtype last_heartbeat: ~datetime.datetime + :keyword process_server_id: The process server Id. + :paramtype process_server_id: str + :keyword master_target_id: The master target Id. + :paramtype master_target_id: str + :keyword consistency_points: The collection of Consistency points. + :paramtype consistency_points: dict[str, ~datetime.datetime] + :keyword disk_resized: A value indicating whether any disk is resized for this VM. + :paramtype disk_resized: str + :keyword reboot_after_update_status: A value indicating whether the source server requires a + restart after update. + :paramtype reboot_after_update_status: str + :keyword multi_vm_group_id: The multi vm group Id, if any. + :paramtype multi_vm_group_id: str + :keyword multi_vm_group_name: The multi vm group name, if any. + :paramtype multi_vm_group_name: str + :keyword multi_vm_sync_status: A value indicating whether the multi vm sync is enabled or + disabled. + :paramtype multi_vm_sync_status: str + :keyword agent_details: The agent details. + :paramtype agent_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageAgentDetails + :keyword v_center_infrastructure_id: The vCenter infrastructure Id. + :paramtype v_center_infrastructure_id: str + :keyword infrastructure_vm_id: The infrastructure VM Id. + :paramtype infrastructure_vm_id: str + :keyword vm_nics: The PE Network details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :keyword discovery_type: A value indicating the discovery type of the machine. + :paramtype discovery_type: str + :keyword azure_storage_account_id: A value indicating the underlying Azure storage account. If + the VM is not running in Azure, this value shall be set to null. + :paramtype azure_storage_account_id: str + :keyword datastores: The datastores of the on-premise machine Value can be list of strings that + contain datastore names. + :paramtype datastores: list[str] + :keyword validation_errors: The validation errors of the on-premise machine Value can be list + of validation errors. + :paramtype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword last_rpo_calculated_time: The last RPO calculated time. + :paramtype last_rpo_calculated_time: ~datetime.datetime + :keyword last_update_received_time: The last update time received from on-prem components. + :paramtype last_update_received_time: ~datetime.datetime + :keyword replica_id: The replica id of the protected item. + :paramtype replica_id: str + :keyword os_version: The OS Version of the protected item. + :paramtype os_version: str + :keyword is_additional_stats_available: A value indicating whether additional IR stats are + available or not. + :paramtype is_additional_stats_available: bool + :keyword total_data_transferred: The total transferred data in bytes. + :paramtype total_data_transferred: int + :keyword total_progress_health: The progress health. + :paramtype total_progress_health: str + """ + super().__init__(**kwargs) + self.instance_type = "InMage" # type: str self.active_site_type = active_site_type self.source_vm_cpu_count = source_vm_cpu_count self.source_vm_ram_size_in_mb = source_vm_ram_size_in_mb @@ -12965,45 +16417,45 @@ class InMageReprotectInput(ReverseReplicationProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param master_target_id: Required. The Master Target Id. - :type master_target_id: str - :param process_server_id: Required. The Process Server Id. - :type process_server_id: str - :param retention_drive: Required. The retention drive to use on the MT. - :type retention_drive: str - :param run_as_account_id: The CS account Id. - :type run_as_account_id: str - :param datastore_name: The target datastore name. - :type datastore_name: str - :param disk_exclusion_input: The enable disk exclusion input. - :type disk_exclusion_input: + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar master_target_id: The Master Target Id. Required. + :vartype master_target_id: str + :ivar process_server_id: The Process Server Id. Required. + :vartype process_server_id: str + :ivar retention_drive: The retention drive to use on the MT. Required. + :vartype retention_drive: str + :ivar run_as_account_id: The CS account Id. + :vartype run_as_account_id: str + :ivar datastore_name: The target datastore name. + :vartype datastore_name: str + :ivar disk_exclusion_input: The enable disk exclusion input. + :vartype disk_exclusion_input: ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput - :param profile_id: Required. The Policy Id. - :type profile_id: str - :param disks_to_include: The disks to include list. - :type disks_to_include: list[str] + :ivar profile_id: The Policy Id. Required. + :vartype profile_id: str + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: list[str] """ _validation = { - 'instance_type': {'required': True}, - 'master_target_id': {'required': True}, - 'process_server_id': {'required': True}, - 'retention_drive': {'required': True}, - 'profile_id': {'required': True}, + "instance_type": {"required": True}, + "master_target_id": {"required": True}, + "process_server_id": {"required": True}, + "retention_drive": {"required": True}, + "profile_id": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'master_target_id': {'key': 'masterTargetId', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'retention_drive': {'key': 'retentionDrive', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'datastore_name': {'key': 'datastoreName', 'type': 'str'}, - 'disk_exclusion_input': {'key': 'diskExclusionInput', 'type': 'InMageDiskExclusionInput'}, - 'profile_id': {'key': 'profileId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[str]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "master_target_id": {"key": "masterTargetId", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "retention_drive": {"key": "retentionDrive", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, + "datastore_name": {"key": "datastoreName", "type": "str"}, + "disk_exclusion_input": {"key": "diskExclusionInput", "type": "InMageDiskExclusionInput"}, + "profile_id": {"key": "profileId", "type": "str"}, + "disks_to_include": {"key": "disksToInclude", "type": "[str]"}, } def __init__( @@ -13015,12 +16467,31 @@ def __init__( profile_id: str, run_as_account_id: Optional[str] = None, datastore_name: Optional[str] = None, - disk_exclusion_input: Optional["InMageDiskExclusionInput"] = None, + disk_exclusion_input: Optional["_models.InMageDiskExclusionInput"] = None, disks_to_include: Optional[List[str]] = None, **kwargs ): - super(InMageReprotectInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str + """ + :keyword master_target_id: The Master Target Id. Required. + :paramtype master_target_id: str + :keyword process_server_id: The Process Server Id. Required. + :paramtype process_server_id: str + :keyword retention_drive: The retention drive to use on the MT. Required. + :paramtype retention_drive: str + :keyword run_as_account_id: The CS account Id. + :paramtype run_as_account_id: str + :keyword datastore_name: The target datastore name. + :paramtype datastore_name: str + :keyword disk_exclusion_input: The enable disk exclusion input. + :paramtype disk_exclusion_input: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput + :keyword profile_id: The Policy Id. Required. + :paramtype profile_id: str + :keyword disks_to_include: The disks to include list. + :paramtype disks_to_include: list[str] + """ + super().__init__(**kwargs) + self.instance_type = "InMage" # type: str self.master_target_id = master_target_id self.process_server_id = process_server_id self.retention_drive = retention_drive @@ -13036,38 +16507,49 @@ class InMageTestFailoverInput(TestFailoverProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In - the other two cases, recovery point id will be ignored. Possible values include: "LatestTime", - "LatestTag", "Custom". - :type recovery_point_type: str or + the other two cases, recovery point id will be ignored. Known values are: "LatestTime", + "LatestTag", and "Custom". + :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType - :param recovery_point_id: The recovery point id to be passed to test failover to a particular + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } def __init__( self, *, - recovery_point_type: Optional[Union[str, "RecoveryPointType"]] = None, + recovery_point_type: Optional[Union[str, "_models.RecoveryPointType"]] = None, recovery_point_id: Optional[str] = None, **kwargs ): - super(InMageTestFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str + """ + :keyword recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or + Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In + the other two cases, recovery point id will be ignored. Known values are: "LatestTime", + "LatestTag", and "Custom". + :paramtype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType + :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMage" # type: str self.recovery_point_type = recovery_point_type self.recovery_point_id = recovery_point_id @@ -13077,121 +16559,137 @@ class InMageUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In - the other two cases, recovery point id will be ignored. Possible values include: "LatestTime", - "LatestTag", "Custom". - :type recovery_point_type: str or + the other two cases, recovery point id will be ignored. Known values are: "LatestTime", + "LatestTag", and "Custom". + :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType - :param recovery_point_id: The recovery point id to be passed to failover to a particular + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed. - :type recovery_point_id: str + :vartype recovery_point_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, } def __init__( self, *, - recovery_point_type: Optional[Union[str, "RecoveryPointType"]] = None, + recovery_point_type: Optional[Union[str, "_models.RecoveryPointType"]] = None, recovery_point_id: Optional[str] = None, **kwargs ): - super(InMageUnplannedFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str + """ + :keyword recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or + Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In + the other two cases, recovery point id will be ignored. Known values are: "LatestTime", + "LatestTag", and "Custom". + :paramtype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType + :keyword recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :paramtype recovery_point_id: str + """ + super().__init__(**kwargs) + self.instance_type = "InMage" # type: str self.recovery_point_type = recovery_point_type self.recovery_point_id = recovery_point_id -class InMageVolumeExclusionOptions(msrest.serialization.Model): +class InMageVolumeExclusionOptions(_serialization.Model): """Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. - :param volume_label: The volume label. The disk having any volume with this label will be + :ivar volume_label: The volume label. The disk having any volume with this label will be excluded from replication. - :type volume_label: str - :param only_exclude_if_single_volume: The value indicating whether to exclude multi volume disk + :vartype volume_label: str + :ivar only_exclude_if_single_volume: The value indicating whether to exclude multi volume disk or not. If a disk has multiple volumes and one of the volume has label matching with VolumeLabel this disk will be excluded from replication if OnlyExcludeIfSingleVolume is false. - :type only_exclude_if_single_volume: str + :vartype only_exclude_if_single_volume: str """ _attribute_map = { - 'volume_label': {'key': 'volumeLabel', 'type': 'str'}, - 'only_exclude_if_single_volume': {'key': 'onlyExcludeIfSingleVolume', 'type': 'str'}, + "volume_label": {"key": "volumeLabel", "type": "str"}, + "only_exclude_if_single_volume": {"key": "onlyExcludeIfSingleVolume", "type": "str"}, } def __init__( - self, - *, - volume_label: Optional[str] = None, - only_exclude_if_single_volume: Optional[str] = None, - **kwargs + self, *, volume_label: Optional[str] = None, only_exclude_if_single_volume: Optional[str] = None, **kwargs ): - super(InMageVolumeExclusionOptions, self).__init__(**kwargs) + """ + :keyword volume_label: The volume label. The disk having any volume with this label will be + excluded from replication. + :paramtype volume_label: str + :keyword only_exclude_if_single_volume: The value indicating whether to exclude multi volume + disk or not. If a disk has multiple volumes and one of the volume has label matching with + VolumeLabel this disk will be excluded from replication if OnlyExcludeIfSingleVolume is false. + :paramtype only_exclude_if_single_volume: str + """ + super().__init__(**kwargs) self.volume_label = volume_label self.only_exclude_if_single_volume = only_exclude_if_single_volume -class InnerHealthError(msrest.serialization.Model): +class InnerHealthError(_serialization.Model): # pylint: disable=too-many-instance-attributes """Implements InnerHealthError class. HealthError object has a list of InnerHealthErrors as child errors. InnerHealthError is used because this will prevent an infinite loop of structures when Hydra tries to auto-generate the contract. We are exposing the related health errors as inner health errors and all API consumers can utilize this in the same fashion as Exception -> InnerException. - :param error_source: Source of error. - :type error_source: str - :param error_type: Type of error. - :type error_type: str - :param error_level: Level of error. - :type error_level: str - :param error_category: Category of error. - :type error_category: str - :param error_code: Error code. - :type error_code: str - :param summary_message: Summary message of the entity. - :type summary_message: str - :param error_message: Error message. - :type error_message: str - :param possible_causes: Possible causes of error. - :type possible_causes: str - :param recommended_action: Recommended action to resolve error. - :type recommended_action: str - :param creation_time_utc: Error creation time (UTC). - :type creation_time_utc: ~datetime.datetime - :param recovery_provider_error_message: DRA error message. - :type recovery_provider_error_message: str - :param entity_id: ID of the entity. - :type entity_id: str - :param error_id: The health error unique id. - :type error_id: str - :param customer_resolvability: Value indicating whether the health error is customer - resolvable. Possible values include: "Allowed", "NotAllowed". - :type customer_resolvability: str or + :ivar error_source: Source of error. + :vartype error_source: str + :ivar error_type: Type of error. + :vartype error_type: str + :ivar error_level: Level of error. + :vartype error_level: str + :ivar error_category: Category of error. + :vartype error_category: str + :ivar error_code: Error code. + :vartype error_code: str + :ivar summary_message: Summary message of the entity. + :vartype summary_message: str + :ivar error_message: Error message. + :vartype error_message: str + :ivar possible_causes: Possible causes of error. + :vartype possible_causes: str + :ivar recommended_action: Recommended action to resolve error. + :vartype recommended_action: str + :ivar creation_time_utc: Error creation time (UTC). + :vartype creation_time_utc: ~datetime.datetime + :ivar recovery_provider_error_message: DRA error message. + :vartype recovery_provider_error_message: str + :ivar entity_id: ID of the entity. + :vartype entity_id: str + :ivar error_id: The health error unique id. + :vartype error_id: str + :ivar customer_resolvability: Value indicating whether the health error is customer resolvable. + Known values are: "Allowed" and "NotAllowed". + :vartype customer_resolvability: str or ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability """ _attribute_map = { - 'error_source': {'key': 'errorSource', 'type': 'str'}, - 'error_type': {'key': 'errorType', 'type': 'str'}, - 'error_level': {'key': 'errorLevel', 'type': 'str'}, - 'error_category': {'key': 'errorCategory', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'summary_message': {'key': 'summaryMessage', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'creation_time_utc': {'key': 'creationTimeUtc', 'type': 'iso-8601'}, - 'recovery_provider_error_message': {'key': 'recoveryProviderErrorMessage', 'type': 'str'}, - 'entity_id': {'key': 'entityId', 'type': 'str'}, - 'error_id': {'key': 'errorId', 'type': 'str'}, - 'customer_resolvability': {'key': 'customerResolvability', 'type': 'str'}, + "error_source": {"key": "errorSource", "type": "str"}, + "error_type": {"key": "errorType", "type": "str"}, + "error_level": {"key": "errorLevel", "type": "str"}, + "error_category": {"key": "errorCategory", "type": "str"}, + "error_code": {"key": "errorCode", "type": "str"}, + "summary_message": {"key": "summaryMessage", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "creation_time_utc": {"key": "creationTimeUtc", "type": "iso-8601"}, + "recovery_provider_error_message": {"key": "recoveryProviderErrorMessage", "type": "str"}, + "entity_id": {"key": "entityId", "type": "str"}, + "error_id": {"key": "errorId", "type": "str"}, + "customer_resolvability": {"key": "customerResolvability", "type": "str"}, } def __init__( @@ -13210,10 +16708,42 @@ def __init__( recovery_provider_error_message: Optional[str] = None, entity_id: Optional[str] = None, error_id: Optional[str] = None, - customer_resolvability: Optional[Union[str, "HealthErrorCustomerResolvability"]] = None, - **kwargs - ): - super(InnerHealthError, self).__init__(**kwargs) + customer_resolvability: Optional[Union[str, "_models.HealthErrorCustomerResolvability"]] = None, + **kwargs + ): + """ + :keyword error_source: Source of error. + :paramtype error_source: str + :keyword error_type: Type of error. + :paramtype error_type: str + :keyword error_level: Level of error. + :paramtype error_level: str + :keyword error_category: Category of error. + :paramtype error_category: str + :keyword error_code: Error code. + :paramtype error_code: str + :keyword summary_message: Summary message of the entity. + :paramtype summary_message: str + :keyword error_message: Error message. + :paramtype error_message: str + :keyword possible_causes: Possible causes of error. + :paramtype possible_causes: str + :keyword recommended_action: Recommended action to resolve error. + :paramtype recommended_action: str + :keyword creation_time_utc: Error creation time (UTC). + :paramtype creation_time_utc: ~datetime.datetime + :keyword recovery_provider_error_message: DRA error message. + :paramtype recovery_provider_error_message: str + :keyword entity_id: ID of the entity. + :paramtype entity_id: str + :keyword error_id: The health error unique id. + :paramtype error_id: str + :keyword customer_resolvability: Value indicating whether the health error is customer + resolvable. Known values are: "Allowed" and "NotAllowed". + :paramtype customer_resolvability: str or + ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability + """ + super().__init__(**kwargs) self.error_source = error_source self.error_type = error_type self.error_level = error_level @@ -13230,24 +16760,24 @@ def __init__( self.customer_resolvability = customer_resolvability -class InputEndpoint(msrest.serialization.Model): +class InputEndpoint(_serialization.Model): """InputEndpoint. - :param endpoint_name: - :type endpoint_name: str - :param private_port: - :type private_port: int - :param public_port: - :type public_port: int - :param protocol: - :type protocol: str + :ivar endpoint_name: + :vartype endpoint_name: str + :ivar private_port: + :vartype private_port: int + :ivar public_port: + :vartype public_port: int + :ivar protocol: + :vartype protocol: str """ _attribute_map = { - 'endpoint_name': {'key': 'endpointName', 'type': 'str'}, - 'private_port': {'key': 'privatePort', 'type': 'int'}, - 'public_port': {'key': 'publicPort', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, + "endpoint_name": {"key": "endpointName", "type": "str"}, + "private_port": {"key": "privatePort", "type": "int"}, + "public_port": {"key": "publicPort", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, } def __init__( @@ -13259,64 +16789,74 @@ def __init__( protocol: Optional[str] = None, **kwargs ): - super(InputEndpoint, self).__init__(**kwargs) + """ + :keyword endpoint_name: + :paramtype endpoint_name: str + :keyword private_port: + :paramtype private_port: int + :keyword public_port: + :paramtype public_port: int + :keyword protocol: + :paramtype protocol: str + """ + super().__init__(**kwargs) self.endpoint_name = endpoint_name self.private_port = private_port self.public_port = public_port self.protocol = protocol -class IPConfigDetails(msrest.serialization.Model): +class IPConfigDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """IPConfigDetails. - :param name: - :type name: str - :param is_primary: - :type is_primary: bool - :param subnet_name: - :type subnet_name: str - :param static_ip_address: - :type static_ip_address: str - :param ip_address_type: - :type ip_address_type: str - :param is_seleted_for_failover: - :type is_seleted_for_failover: bool - :param recovery_subnet_name: - :type recovery_subnet_name: str - :param recovery_static_ip_address: - :type recovery_static_ip_address: str - :param recovery_ip_address_type: - :type recovery_ip_address_type: str - :param recovery_public_ip_address_id: - :type recovery_public_ip_address_id: str - :param recovery_lb_backend_address_pool_ids: - :type recovery_lb_backend_address_pool_ids: list[str] - :param tfo_subnet_name: - :type tfo_subnet_name: str - :param tfo_static_ip_address: - :type tfo_static_ip_address: str - :param tfo_public_ip_address_id: - :type tfo_public_ip_address_id: str - :param tfo_lb_backend_address_pool_ids: - :type tfo_lb_backend_address_pool_ids: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_primary': {'key': 'isPrimary', 'type': 'bool'}, - 'subnet_name': {'key': 'subnetName', 'type': 'str'}, - 'static_ip_address': {'key': 'staticIPAddress', 'type': 'str'}, - 'ip_address_type': {'key': 'ipAddressType', 'type': 'str'}, - 'is_seleted_for_failover': {'key': 'isSeletedForFailover', 'type': 'bool'}, - 'recovery_subnet_name': {'key': 'recoverySubnetName', 'type': 'str'}, - 'recovery_static_ip_address': {'key': 'recoveryStaticIPAddress', 'type': 'str'}, - 'recovery_ip_address_type': {'key': 'recoveryIPAddressType', 'type': 'str'}, - 'recovery_public_ip_address_id': {'key': 'recoveryPublicIPAddressId', 'type': 'str'}, - 'recovery_lb_backend_address_pool_ids': {'key': 'recoveryLBBackendAddressPoolIds', 'type': '[str]'}, - 'tfo_subnet_name': {'key': 'tfoSubnetName', 'type': 'str'}, - 'tfo_static_ip_address': {'key': 'tfoStaticIPAddress', 'type': 'str'}, - 'tfo_public_ip_address_id': {'key': 'tfoPublicIPAddressId', 'type': 'str'}, - 'tfo_lb_backend_address_pool_ids': {'key': 'tfoLBBackendAddressPoolIds', 'type': '[str]'}, + :ivar name: + :vartype name: str + :ivar is_primary: + :vartype is_primary: bool + :ivar subnet_name: + :vartype subnet_name: str + :ivar static_ip_address: + :vartype static_ip_address: str + :ivar ip_address_type: + :vartype ip_address_type: str + :ivar is_seleted_for_failover: + :vartype is_seleted_for_failover: bool + :ivar recovery_subnet_name: + :vartype recovery_subnet_name: str + :ivar recovery_static_ip_address: + :vartype recovery_static_ip_address: str + :ivar recovery_ip_address_type: + :vartype recovery_ip_address_type: str + :ivar recovery_public_ip_address_id: + :vartype recovery_public_ip_address_id: str + :ivar recovery_lb_backend_address_pool_ids: + :vartype recovery_lb_backend_address_pool_ids: list[str] + :ivar tfo_subnet_name: + :vartype tfo_subnet_name: str + :ivar tfo_static_ip_address: + :vartype tfo_static_ip_address: str + :ivar tfo_public_ip_address_id: + :vartype tfo_public_ip_address_id: str + :ivar tfo_lb_backend_address_pool_ids: + :vartype tfo_lb_backend_address_pool_ids: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "is_primary": {"key": "isPrimary", "type": "bool"}, + "subnet_name": {"key": "subnetName", "type": "str"}, + "static_ip_address": {"key": "staticIPAddress", "type": "str"}, + "ip_address_type": {"key": "ipAddressType", "type": "str"}, + "is_seleted_for_failover": {"key": "isSeletedForFailover", "type": "bool"}, + "recovery_subnet_name": {"key": "recoverySubnetName", "type": "str"}, + "recovery_static_ip_address": {"key": "recoveryStaticIPAddress", "type": "str"}, + "recovery_ip_address_type": {"key": "recoveryIPAddressType", "type": "str"}, + "recovery_public_ip_address_id": {"key": "recoveryPublicIPAddressId", "type": "str"}, + "recovery_lb_backend_address_pool_ids": {"key": "recoveryLBBackendAddressPoolIds", "type": "[str]"}, + "tfo_subnet_name": {"key": "tfoSubnetName", "type": "str"}, + "tfo_static_ip_address": {"key": "tfoStaticIPAddress", "type": "str"}, + "tfo_public_ip_address_id": {"key": "tfoPublicIPAddressId", "type": "str"}, + "tfo_lb_backend_address_pool_ids": {"key": "tfoLBBackendAddressPoolIds", "type": "[str]"}, } def __init__( @@ -13339,7 +16879,39 @@ def __init__( tfo_lb_backend_address_pool_ids: Optional[List[str]] = None, **kwargs ): - super(IPConfigDetails, self).__init__(**kwargs) + """ + :keyword name: + :paramtype name: str + :keyword is_primary: + :paramtype is_primary: bool + :keyword subnet_name: + :paramtype subnet_name: str + :keyword static_ip_address: + :paramtype static_ip_address: str + :keyword ip_address_type: + :paramtype ip_address_type: str + :keyword is_seleted_for_failover: + :paramtype is_seleted_for_failover: bool + :keyword recovery_subnet_name: + :paramtype recovery_subnet_name: str + :keyword recovery_static_ip_address: + :paramtype recovery_static_ip_address: str + :keyword recovery_ip_address_type: + :paramtype recovery_ip_address_type: str + :keyword recovery_public_ip_address_id: + :paramtype recovery_public_ip_address_id: str + :keyword recovery_lb_backend_address_pool_ids: + :paramtype recovery_lb_backend_address_pool_ids: list[str] + :keyword tfo_subnet_name: + :paramtype tfo_subnet_name: str + :keyword tfo_static_ip_address: + :paramtype tfo_static_ip_address: str + :keyword tfo_public_ip_address_id: + :paramtype tfo_public_ip_address_id: str + :keyword tfo_lb_backend_address_pool_ids: + :paramtype tfo_lb_backend_address_pool_ids: list[str] + """ + super().__init__(**kwargs) self.name = name self.is_primary = is_primary self.subnet_name = subnet_name @@ -13357,45 +16929,45 @@ def __init__( self.tfo_lb_backend_address_pool_ids = tfo_lb_backend_address_pool_ids -class IPConfigInputDetails(msrest.serialization.Model): +class IPConfigInputDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """IPConfigInputDetails. - :param ip_config_name: - :type ip_config_name: str - :param is_primary: - :type is_primary: bool - :param is_seleted_for_failover: - :type is_seleted_for_failover: bool - :param recovery_subnet_name: - :type recovery_subnet_name: str - :param recovery_static_ip_address: - :type recovery_static_ip_address: str - :param recovery_public_ip_address_id: - :type recovery_public_ip_address_id: str - :param recovery_lb_backend_address_pool_ids: - :type recovery_lb_backend_address_pool_ids: list[str] - :param tfo_subnet_name: - :type tfo_subnet_name: str - :param tfo_static_ip_address: - :type tfo_static_ip_address: str - :param tfo_public_ip_address_id: - :type tfo_public_ip_address_id: str - :param tfo_lb_backend_address_pool_ids: - :type tfo_lb_backend_address_pool_ids: list[str] - """ - - _attribute_map = { - 'ip_config_name': {'key': 'ipConfigName', 'type': 'str'}, - 'is_primary': {'key': 'isPrimary', 'type': 'bool'}, - 'is_seleted_for_failover': {'key': 'isSeletedForFailover', 'type': 'bool'}, - 'recovery_subnet_name': {'key': 'recoverySubnetName', 'type': 'str'}, - 'recovery_static_ip_address': {'key': 'recoveryStaticIPAddress', 'type': 'str'}, - 'recovery_public_ip_address_id': {'key': 'recoveryPublicIPAddressId', 'type': 'str'}, - 'recovery_lb_backend_address_pool_ids': {'key': 'recoveryLBBackendAddressPoolIds', 'type': '[str]'}, - 'tfo_subnet_name': {'key': 'tfoSubnetName', 'type': 'str'}, - 'tfo_static_ip_address': {'key': 'tfoStaticIPAddress', 'type': 'str'}, - 'tfo_public_ip_address_id': {'key': 'tfoPublicIPAddressId', 'type': 'str'}, - 'tfo_lb_backend_address_pool_ids': {'key': 'tfoLBBackendAddressPoolIds', 'type': '[str]'}, + :ivar ip_config_name: + :vartype ip_config_name: str + :ivar is_primary: + :vartype is_primary: bool + :ivar is_seleted_for_failover: + :vartype is_seleted_for_failover: bool + :ivar recovery_subnet_name: + :vartype recovery_subnet_name: str + :ivar recovery_static_ip_address: + :vartype recovery_static_ip_address: str + :ivar recovery_public_ip_address_id: + :vartype recovery_public_ip_address_id: str + :ivar recovery_lb_backend_address_pool_ids: + :vartype recovery_lb_backend_address_pool_ids: list[str] + :ivar tfo_subnet_name: + :vartype tfo_subnet_name: str + :ivar tfo_static_ip_address: + :vartype tfo_static_ip_address: str + :ivar tfo_public_ip_address_id: + :vartype tfo_public_ip_address_id: str + :ivar tfo_lb_backend_address_pool_ids: + :vartype tfo_lb_backend_address_pool_ids: list[str] + """ + + _attribute_map = { + "ip_config_name": {"key": "ipConfigName", "type": "str"}, + "is_primary": {"key": "isPrimary", "type": "bool"}, + "is_seleted_for_failover": {"key": "isSeletedForFailover", "type": "bool"}, + "recovery_subnet_name": {"key": "recoverySubnetName", "type": "str"}, + "recovery_static_ip_address": {"key": "recoveryStaticIPAddress", "type": "str"}, + "recovery_public_ip_address_id": {"key": "recoveryPublicIPAddressId", "type": "str"}, + "recovery_lb_backend_address_pool_ids": {"key": "recoveryLBBackendAddressPoolIds", "type": "[str]"}, + "tfo_subnet_name": {"key": "tfoSubnetName", "type": "str"}, + "tfo_static_ip_address": {"key": "tfoStaticIPAddress", "type": "str"}, + "tfo_public_ip_address_id": {"key": "tfoPublicIPAddressId", "type": "str"}, + "tfo_lb_backend_address_pool_ids": {"key": "tfoLBBackendAddressPoolIds", "type": "[str]"}, } def __init__( @@ -13414,7 +16986,31 @@ def __init__( tfo_lb_backend_address_pool_ids: Optional[List[str]] = None, **kwargs ): - super(IPConfigInputDetails, self).__init__(**kwargs) + """ + :keyword ip_config_name: + :paramtype ip_config_name: str + :keyword is_primary: + :paramtype is_primary: bool + :keyword is_seleted_for_failover: + :paramtype is_seleted_for_failover: bool + :keyword recovery_subnet_name: + :paramtype recovery_subnet_name: str + :keyword recovery_static_ip_address: + :paramtype recovery_static_ip_address: str + :keyword recovery_public_ip_address_id: + :paramtype recovery_public_ip_address_id: str + :keyword recovery_lb_backend_address_pool_ids: + :paramtype recovery_lb_backend_address_pool_ids: list[str] + :keyword tfo_subnet_name: + :paramtype tfo_subnet_name: str + :keyword tfo_static_ip_address: + :paramtype tfo_static_ip_address: str + :keyword tfo_public_ip_address_id: + :paramtype tfo_public_ip_address_id: str + :keyword tfo_lb_backend_address_pool_ids: + :paramtype tfo_lb_backend_address_pool_ids: list[str] + """ + super().__init__(**kwargs) self.ip_config_name = ip_config_name self.is_primary = is_primary self.is_seleted_for_failover = is_seleted_for_failover @@ -13439,87 +17035,89 @@ class Job(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.JobProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The custom data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.JobProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'JobProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "JobProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["JobProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.JobProperties"] = None, **kwargs ): - super(Job, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The custom data. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.JobProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class JobCollection(msrest.serialization.Model): +class JobCollection(_serialization.Model): """Collection of jobs. - :param value: The list of jobs. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The list of jobs. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Job]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Job]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["Job"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(JobCollection, self).__init__(**kwargs) + def __init__(self, *, value: Optional[List["_models.Job"]] = None, next_link: Optional[str] = None, **kwargs): + """ + :keyword value: The list of jobs. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class JobEntity(msrest.serialization.Model): +class JobEntity(_serialization.Model): """This class contains the minimal job details required to navigate to the desired drill down. - :param job_id: The job id. - :type job_id: str - :param job_friendly_name: The job display name. - :type job_friendly_name: str - :param target_object_id: The object id. - :type target_object_id: str - :param target_object_name: The object name. - :type target_object_name: str - :param target_instance_type: The workflow affected object type. - :type target_instance_type: str - :param job_scenario_name: The job name. Enum type ScenarioName. - :type job_scenario_name: str + :ivar job_id: The job id. + :vartype job_id: str + :ivar job_friendly_name: The job display name. + :vartype job_friendly_name: str + :ivar target_object_id: The object id. + :vartype target_object_id: str + :ivar target_object_name: The object name. + :vartype target_object_name: str + :ivar target_instance_type: The workflow affected object type. + :vartype target_instance_type: str + :ivar job_scenario_name: The job name. Enum type ScenarioName. + :vartype job_scenario_name: str """ _attribute_map = { - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'job_friendly_name': {'key': 'jobFriendlyName', 'type': 'str'}, - 'target_object_id': {'key': 'targetObjectId', 'type': 'str'}, - 'target_object_name': {'key': 'targetObjectName', 'type': 'str'}, - 'target_instance_type': {'key': 'targetInstanceType', 'type': 'str'}, - 'job_scenario_name': {'key': 'jobScenarioName', 'type': 'str'}, + "job_id": {"key": "jobId", "type": "str"}, + "job_friendly_name": {"key": "jobFriendlyName", "type": "str"}, + "target_object_id": {"key": "targetObjectId", "type": "str"}, + "target_object_name": {"key": "targetObjectName", "type": "str"}, + "target_instance_type": {"key": "targetInstanceType", "type": "str"}, + "job_scenario_name": {"key": "jobScenarioName", "type": "str"}, } def __init__( @@ -13533,7 +17131,21 @@ def __init__( job_scenario_name: Optional[str] = None, **kwargs ): - super(JobEntity, self).__init__(**kwargs) + """ + :keyword job_id: The job id. + :paramtype job_id: str + :keyword job_friendly_name: The job display name. + :paramtype job_friendly_name: str + :keyword target_object_id: The object id. + :paramtype target_object_id: str + :keyword target_object_name: The object name. + :paramtype target_object_name: str + :keyword target_instance_type: The workflow affected object type. + :paramtype target_instance_type: str + :keyword job_scenario_name: The job name. Enum type ScenarioName. + :paramtype job_scenario_name: str + """ + super().__init__(**kwargs) self.job_id = job_id self.job_friendly_name = job_friendly_name self.target_object_id = target_object_id @@ -13542,40 +17154,53 @@ def __init__( self.job_scenario_name = job_scenario_name -class JobErrorDetails(msrest.serialization.Model): +class JobErrorDetails(_serialization.Model): """This class contains the error details per object. - :param service_error_details: The Service error details. - :type service_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ServiceError - :param provider_error_details: The Provider error details. - :type provider_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ProviderError - :param error_level: Error level of error. - :type error_level: str - :param creation_time: The creation time of job error. - :type creation_time: ~datetime.datetime - :param task_id: The Id of the task. - :type task_id: str + :ivar service_error_details: The Service error details. + :vartype service_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ServiceError + :ivar provider_error_details: The Provider error details. + :vartype provider_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ProviderError + :ivar error_level: Error level of error. + :vartype error_level: str + :ivar creation_time: The creation time of job error. + :vartype creation_time: ~datetime.datetime + :ivar task_id: The Id of the task. + :vartype task_id: str """ _attribute_map = { - 'service_error_details': {'key': 'serviceErrorDetails', 'type': 'ServiceError'}, - 'provider_error_details': {'key': 'providerErrorDetails', 'type': 'ProviderError'}, - 'error_level': {'key': 'errorLevel', 'type': 'str'}, - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'task_id': {'key': 'taskId', 'type': 'str'}, + "service_error_details": {"key": "serviceErrorDetails", "type": "ServiceError"}, + "provider_error_details": {"key": "providerErrorDetails", "type": "ProviderError"}, + "error_level": {"key": "errorLevel", "type": "str"}, + "creation_time": {"key": "creationTime", "type": "iso-8601"}, + "task_id": {"key": "taskId", "type": "str"}, } def __init__( self, *, - service_error_details: Optional["ServiceError"] = None, - provider_error_details: Optional["ProviderError"] = None, + service_error_details: Optional["_models.ServiceError"] = None, + provider_error_details: Optional["_models.ProviderError"] = None, error_level: Optional[str] = None, creation_time: Optional[datetime.datetime] = None, task_id: Optional[str] = None, **kwargs ): - super(JobErrorDetails, self).__init__(**kwargs) + """ + :keyword service_error_details: The Service error details. + :paramtype service_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ServiceError + :keyword provider_error_details: The Provider error details. + :paramtype provider_error_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ProviderError + :keyword error_level: Error level of error. + :paramtype error_level: str + :keyword creation_time: The creation time of job error. + :paramtype creation_time: ~datetime.datetime + :keyword task_id: The Id of the task. + :paramtype task_id: str + """ + super().__init__(**kwargs) self.service_error_details = service_error_details self.provider_error_details = provider_error_details self.error_level = error_level @@ -13583,57 +17208,57 @@ def __init__( self.task_id = task_id -class JobProperties(msrest.serialization.Model): +class JobProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Job custom data details. - :param activity_id: The activity id. - :type activity_id: str - :param scenario_name: The ScenarioName. - :type scenario_name: str - :param friendly_name: The DisplayName. - :type friendly_name: str - :param state: The status of the Job. It is one of these values - NotStarted, InProgress, + :ivar activity_id: The activity id. + :vartype activity_id: str + :ivar scenario_name: The ScenarioName. + :vartype scenario_name: str + :ivar friendly_name: The DisplayName. + :vartype friendly_name: str + :ivar state: The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other. - :type state: str - :param state_description: The description of the state of the Job. For e.g. - For Succeeded + :vartype state: str + :ivar state_description: The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - :type state_description: str - :param tasks: The tasks. - :type tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :param errors: The errors. - :type errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] - :param start_time: The start time. - :type start_time: ~datetime.datetime - :param end_time: The end time. - :type end_time: ~datetime.datetime - :param allowed_actions: The Allowed action the job. - :type allowed_actions: list[str] - :param target_object_id: The affected Object Id. - :type target_object_id: str - :param target_object_name: The name of the affected object. - :type target_object_name: str - :param target_instance_type: The type of the affected object which is of + :vartype state_description: str + :ivar tasks: The tasks. + :vartype tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :ivar errors: The errors. + :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] + :ivar start_time: The start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time. + :vartype end_time: ~datetime.datetime + :ivar allowed_actions: The Allowed action the job. + :vartype allowed_actions: list[str] + :ivar target_object_id: The affected Object Id. + :vartype target_object_id: str + :ivar target_object_name: The name of the affected object. + :vartype target_object_name: str + :ivar target_instance_type: The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. - :type target_instance_type: str - :param custom_details: The custom job details like test failover job details. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.JobDetails + :vartype target_instance_type: str + :ivar custom_details: The custom job details like test failover job details. + :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.JobDetails """ _attribute_map = { - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'scenario_name': {'key': 'scenarioName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'state_description': {'key': 'stateDescription', 'type': 'str'}, - 'tasks': {'key': 'tasks', 'type': '[ASRTask]'}, - 'errors': {'key': 'errors', 'type': '[JobErrorDetails]'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'allowed_actions': {'key': 'allowedActions', 'type': '[str]'}, - 'target_object_id': {'key': 'targetObjectId', 'type': 'str'}, - 'target_object_name': {'key': 'targetObjectName', 'type': 'str'}, - 'target_instance_type': {'key': 'targetInstanceType', 'type': 'str'}, - 'custom_details': {'key': 'customDetails', 'type': 'JobDetails'}, + "activity_id": {"key": "activityId", "type": "str"}, + "scenario_name": {"key": "scenarioName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "state_description": {"key": "stateDescription", "type": "str"}, + "tasks": {"key": "tasks", "type": "[ASRTask]"}, + "errors": {"key": "errors", "type": "[JobErrorDetails]"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "allowed_actions": {"key": "allowedActions", "type": "[str]"}, + "target_object_id": {"key": "targetObjectId", "type": "str"}, + "target_object_name": {"key": "targetObjectName", "type": "str"}, + "target_instance_type": {"key": "targetInstanceType", "type": "str"}, + "custom_details": {"key": "customDetails", "type": "JobDetails"}, } def __init__( @@ -13644,18 +17269,51 @@ def __init__( friendly_name: Optional[str] = None, state: Optional[str] = None, state_description: Optional[str] = None, - tasks: Optional[List["ASRTask"]] = None, - errors: Optional[List["JobErrorDetails"]] = None, + tasks: Optional[List["_models.ASRTask"]] = None, + errors: Optional[List["_models.JobErrorDetails"]] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, allowed_actions: Optional[List[str]] = None, target_object_id: Optional[str] = None, target_object_name: Optional[str] = None, target_instance_type: Optional[str] = None, - custom_details: Optional["JobDetails"] = None, - **kwargs - ): - super(JobProperties, self).__init__(**kwargs) + custom_details: Optional["_models.JobDetails"] = None, + **kwargs + ): + """ + :keyword activity_id: The activity id. + :paramtype activity_id: str + :keyword scenario_name: The ScenarioName. + :paramtype scenario_name: str + :keyword friendly_name: The DisplayName. + :paramtype friendly_name: str + :keyword state: The status of the Job. It is one of these values - NotStarted, InProgress, + Succeeded, Failed, Cancelled, Suspended or Other. + :paramtype state: str + :keyword state_description: The description of the state of the Job. For e.g. - For Succeeded + state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. + :paramtype state_description: str + :keyword tasks: The tasks. + :paramtype tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :keyword errors: The errors. + :paramtype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] + :keyword start_time: The start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time. + :paramtype end_time: ~datetime.datetime + :keyword allowed_actions: The Allowed action the job. + :paramtype allowed_actions: list[str] + :keyword target_object_id: The affected Object Id. + :paramtype target_object_id: str + :keyword target_object_name: The name of the affected object. + :paramtype target_object_name: str + :keyword target_instance_type: The type of the affected object which is of + Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. + :paramtype target_instance_type: str + :keyword custom_details: The custom job details like test failover job details. + :paramtype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.JobDetails + """ + super().__init__(**kwargs) self.activity_id = activity_id self.scenario_name = scenario_name self.friendly_name = friendly_name @@ -13672,38 +17330,38 @@ def __init__( self.custom_details = custom_details -class JobQueryParameter(msrest.serialization.Model): +class JobQueryParameter(_serialization.Model): """Query parameter to enumerate jobs. - :param start_time: Date time to get jobs from. - :type start_time: str - :param end_time: Date time to get jobs upto. - :type end_time: str - :param fabric_id: The Id of the fabric to search jobs under. - :type fabric_id: str - :param affected_object_types: The type of objects. - :type affected_object_types: str - :param job_status: The states of the job to be filtered can be in. - :type job_status: str - :param job_output_type: The output type of the jobs. Possible values include: "Json", "Xml", + :ivar start_time: Date time to get jobs from. + :vartype start_time: str + :ivar end_time: Date time to get jobs upto. + :vartype end_time: str + :ivar fabric_id: The Id of the fabric to search jobs under. + :vartype fabric_id: str + :ivar affected_object_types: The type of objects. + :vartype affected_object_types: str + :ivar job_status: The states of the job to be filtered can be in. + :vartype job_status: str + :ivar job_output_type: The output type of the jobs. Known values are: "Json", "Xml", and "Excel". - :type job_output_type: str or + :vartype job_output_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.ExportJobOutputSerializationType - :param job_name: The job Name. - :type job_name: str - :param timezone_offset: The timezone offset for the location of the request (in minutes). - :type timezone_offset: float + :ivar job_name: The job Name. + :vartype job_name: str + :ivar timezone_offset: The timezone offset for the location of the request (in minutes). + :vartype timezone_offset: float """ _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'end_time': {'key': 'endTime', 'type': 'str'}, - 'fabric_id': {'key': 'fabricId', 'type': 'str'}, - 'affected_object_types': {'key': 'affectedObjectTypes', 'type': 'str'}, - 'job_status': {'key': 'jobStatus', 'type': 'str'}, - 'job_output_type': {'key': 'jobOutputType', 'type': 'str'}, - 'job_name': {'key': 'jobName', 'type': 'str'}, - 'timezone_offset': {'key': 'timezoneOffset', 'type': 'float'}, + "start_time": {"key": "startTime", "type": "str"}, + "end_time": {"key": "endTime", "type": "str"}, + "fabric_id": {"key": "fabricId", "type": "str"}, + "affected_object_types": {"key": "affectedObjectTypes", "type": "str"}, + "job_status": {"key": "jobStatus", "type": "str"}, + "job_output_type": {"key": "jobOutputType", "type": "str"}, + "job_name": {"key": "jobName", "type": "str"}, + "timezone_offset": {"key": "timezoneOffset", "type": "float"}, } def __init__( @@ -13714,12 +17372,32 @@ def __init__( fabric_id: Optional[str] = None, affected_object_types: Optional[str] = None, job_status: Optional[str] = None, - job_output_type: Optional[Union[str, "ExportJobOutputSerializationType"]] = None, + job_output_type: Optional[Union[str, "_models.ExportJobOutputSerializationType"]] = None, job_name: Optional[str] = None, timezone_offset: Optional[float] = None, **kwargs ): - super(JobQueryParameter, self).__init__(**kwargs) + """ + :keyword start_time: Date time to get jobs from. + :paramtype start_time: str + :keyword end_time: Date time to get jobs upto. + :paramtype end_time: str + :keyword fabric_id: The Id of the fabric to search jobs under. + :paramtype fabric_id: str + :keyword affected_object_types: The type of objects. + :paramtype affected_object_types: str + :keyword job_status: The states of the job to be filtered can be in. + :paramtype job_status: str + :keyword job_output_type: The output type of the jobs. Known values are: "Json", "Xml", and + "Excel". + :paramtype job_output_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.ExportJobOutputSerializationType + :keyword job_name: The job Name. + :paramtype job_name: str + :keyword timezone_offset: The timezone offset for the location of the request (in minutes). + :paramtype timezone_offset: float + """ + super().__init__(**kwargs) self.start_time = start_time self.end_time = end_time self.fabric_id = fabric_id @@ -13735,29 +17413,28 @@ class JobStatusEventDetails(EventSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param job_id: Job arm id for the event. - :type job_id: str - :param job_friendly_name: JobName for the Event. - :type job_friendly_name: str - :param job_status: JobStatus for the Event. - :type job_status: str - :param affected_object_type: AffectedObjectType for the event. - :type affected_object_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar job_id: Job arm id for the event. + :vartype job_id: str + :ivar job_friendly_name: JobName for the Event. + :vartype job_friendly_name: str + :ivar job_status: JobStatus for the Event. + :vartype job_status: str + :ivar affected_object_type: AffectedObjectType for the event. + :vartype affected_object_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'job_friendly_name': {'key': 'jobFriendlyName', 'type': 'str'}, - 'job_status': {'key': 'jobStatus', 'type': 'str'}, - 'affected_object_type': {'key': 'affectedObjectType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "job_friendly_name": {"key": "jobFriendlyName", "type": "str"}, + "job_status": {"key": "jobStatus", "type": "str"}, + "affected_object_type": {"key": "affectedObjectType", "type": "str"}, } def __init__( @@ -13769,36 +17446,48 @@ def __init__( affected_object_type: Optional[str] = None, **kwargs ): - super(JobStatusEventDetails, self).__init__(**kwargs) - self.instance_type = 'JobStatus' # type: str + """ + :keyword job_id: Job arm id for the event. + :paramtype job_id: str + :keyword job_friendly_name: JobName for the Event. + :paramtype job_friendly_name: str + :keyword job_status: JobStatus for the Event. + :paramtype job_status: str + :keyword affected_object_type: AffectedObjectType for the event. + :paramtype affected_object_type: str + """ + super().__init__(**kwargs) + self.instance_type = "JobStatus" # type: str self.job_id = job_id self.job_friendly_name = job_friendly_name self.job_status = job_status self.affected_object_type = affected_object_type -class KeyEncryptionKeyInfo(msrest.serialization.Model): +class KeyEncryptionKeyInfo(_serialization.Model): """Key Encryption Key (KEK) information. - :param key_identifier: The key URL / identifier. - :type key_identifier: str - :param key_vault_resource_arm_id: The KeyVault resource ARM Id for key. - :type key_vault_resource_arm_id: str + :ivar key_identifier: The key URL / identifier. + :vartype key_identifier: str + :ivar key_vault_resource_arm_id: The KeyVault resource ARM Id for key. + :vartype key_vault_resource_arm_id: str """ _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'key_vault_resource_arm_id': {'key': 'keyVaultResourceArmId', 'type': 'str'}, + "key_identifier": {"key": "keyIdentifier", "type": "str"}, + "key_vault_resource_arm_id": {"key": "keyVaultResourceArmId", "type": "str"}, } def __init__( - self, - *, - key_identifier: Optional[str] = None, - key_vault_resource_arm_id: Optional[str] = None, - **kwargs + self, *, key_identifier: Optional[str] = None, key_vault_resource_arm_id: Optional[str] = None, **kwargs ): - super(KeyEncryptionKeyInfo, self).__init__(**kwargs) + """ + :keyword key_identifier: The key URL / identifier. + :paramtype key_identifier: str + :keyword key_vault_resource_arm_id: The KeyVault resource ARM Id for key. + :paramtype key_vault_resource_arm_id: str + """ + super().__init__(**kwargs) self.key_identifier = key_identifier self.key_vault_resource_arm_id = key_vault_resource_arm_id @@ -13814,84 +17503,92 @@ class LogicalNetwork(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The Logical Network Properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The Logical Network Properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LogicalNetworkProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "LogicalNetworkProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["LogicalNetworkProperties"] = None, + properties: Optional["_models.LogicalNetworkProperties"] = None, **kwargs ): - super(LogicalNetwork, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The Logical Network Properties. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class LogicalNetworkCollection(msrest.serialization.Model): +class LogicalNetworkCollection(_serialization.Model): """List of logical networks. - :param value: The Logical Networks list details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The Logical Networks list details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[LogicalNetwork]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[LogicalNetwork]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["LogicalNetwork"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.LogicalNetwork"]] = None, next_link: Optional[str] = None, **kwargs ): - super(LogicalNetworkCollection, self).__init__(**kwargs) + """ + :keyword value: The Logical Networks list details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class LogicalNetworkProperties(msrest.serialization.Model): +class LogicalNetworkProperties(_serialization.Model): """Logical Network Properties. - :param friendly_name: The Friendly Name. - :type friendly_name: str - :param network_virtualization_status: A value indicating whether Network Virtualization is + :ivar friendly_name: The Friendly Name. + :vartype friendly_name: str + :ivar network_virtualization_status: A value indicating whether Network Virtualization is enabled for the logical network. - :type network_virtualization_status: str - :param logical_network_usage: A value indicating whether logical network is used as private - test network by test failover. - :type logical_network_usage: str - :param logical_network_definitions_status: A value indicating whether logical network + :vartype network_virtualization_status: str + :ivar logical_network_usage: A value indicating whether logical network is used as private test + network by test failover. + :vartype logical_network_usage: str + :ivar logical_network_definitions_status: A value indicating whether logical network definitions are isolated. - :type logical_network_definitions_status: str + :vartype logical_network_definitions_status: str """ _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'network_virtualization_status': {'key': 'networkVirtualizationStatus', 'type': 'str'}, - 'logical_network_usage': {'key': 'logicalNetworkUsage', 'type': 'str'}, - 'logical_network_definitions_status': {'key': 'logicalNetworkDefinitionsStatus', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "network_virtualization_status": {"key": "networkVirtualizationStatus", "type": "str"}, + "logical_network_usage": {"key": "logicalNetworkUsage", "type": "str"}, + "logical_network_definitions_status": {"key": "logicalNetworkDefinitionsStatus", "type": "str"}, } def __init__( @@ -13903,7 +17600,20 @@ def __init__( logical_network_definitions_status: Optional[str] = None, **kwargs ): - super(LogicalNetworkProperties, self).__init__(**kwargs) + """ + :keyword friendly_name: The Friendly Name. + :paramtype friendly_name: str + :keyword network_virtualization_status: A value indicating whether Network Virtualization is + enabled for the logical network. + :paramtype network_virtualization_status: str + :keyword logical_network_usage: A value indicating whether logical network is used as private + test network by test failover. + :paramtype logical_network_usage: str + :keyword logical_network_definitions_status: A value indicating whether logical network + definitions are isolated. + :paramtype logical_network_definitions_status: str + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.network_virtualization_status = network_virtualization_status self.logical_network_usage = logical_network_usage @@ -13915,25 +17625,25 @@ class ManualActionTaskDetails(TaskTypeDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param name: The name. - :type name: str - :param instructions: The instructions. - :type instructions: str - :param observation: The observation. - :type observation: str + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar name: The name. + :vartype name: str + :ivar instructions: The instructions. + :vartype instructions: str + :ivar observation: The observation. + :vartype observation: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'instructions': {'key': 'instructions', 'type': 'str'}, - 'observation': {'key': 'observation', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "instructions": {"key": "instructions", "type": "str"}, + "observation": {"key": "observation", "type": "str"}, } def __init__( @@ -13944,14 +17654,22 @@ def __init__( observation: Optional[str] = None, **kwargs ): - super(ManualActionTaskDetails, self).__init__(**kwargs) - self.instance_type = 'ManualActionTaskDetails' # type: str + """ + :keyword name: The name. + :paramtype name: str + :keyword instructions: The instructions. + :paramtype instructions: str + :keyword observation: The observation. + :paramtype observation: str + """ + super().__init__(**kwargs) + self.instance_type = "ManualActionTaskDetails" # type: str self.name = name self.instructions = instructions self.observation = observation -class MarsAgentDetails(msrest.serialization.Model): +class MarsAgentDetails(_serialization.Model): """Mars agent details. Variables are only populated by the server, and will be ignored when sending a request. @@ -13970,42 +17688,40 @@ class MarsAgentDetails(msrest.serialization.Model): :vartype version: str :ivar last_heartbeat_utc: The last heartbeat received from the Mars agent. :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the Mars agent. Possible values include: "None", "Normal", - "Warning", "Critical". + :ivar health: The health of the Mars agent. Known values are: "None", "Normal", "Warning", and + "Critical". :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth :ivar health_errors: The health errors. :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "bios_id": {"readonly": True}, + "fabric_object_id": {"readonly": True}, + "fqdn": {"readonly": True}, + "version": {"readonly": True}, + "last_heartbeat_utc": {"readonly": True}, + "health": {"readonly": True}, + "health_errors": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "health": {"key": "health", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, } - def __init__( - self, - **kwargs - ): - super(MarsAgentDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.bios_id = None @@ -14017,93 +17733,135 @@ def __init__( self.health_errors = None -class MasterTargetServer(msrest.serialization.Model): +class MasterTargetServer(_serialization.Model): # pylint: disable=too-many-instance-attributes """Details of a Master Target Server. - :param id: The server Id. - :type id: str - :param ip_address: The IP address of the server. - :type ip_address: str - :param name: The server name. - :type name: str - :param os_type: The OS type of the server. - :type os_type: str - :param agent_version: The version of the scout component on the server. - :type agent_version: str - :param last_heartbeat: The last heartbeat received from the server. - :type last_heartbeat: ~datetime.datetime - :param version_status: Version status. - :type version_status: str - :param retention_volumes: The retention volumes of Master target Server. - :type retention_volumes: list[~azure.mgmt.recoveryservicessiterecovery.models.RetentionVolume] - :param data_stores: The list of data stores in the fabric. - :type data_stores: list[~azure.mgmt.recoveryservicessiterecovery.models.DataStore] - :param validation_errors: Validation errors. - :type validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param health_errors: Health errors. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param disk_count: Disk count of the master target. - :type disk_count: int - :param os_version: OS Version of the master target. - :type os_version: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param mars_agent_version: MARS agent version. - :type mars_agent_version: str - :param mars_agent_expiry_date: MARS agent expiry date. - :type mars_agent_expiry_date: ~datetime.datetime - :param agent_version_details: Agent version details. - :type agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - :param mars_agent_version_details: Mars agent version details. - :type mars_agent_version_details: + :ivar id: The server Id. + :vartype id: str + :ivar ip_address: The IP address of the server. + :vartype ip_address: str + :ivar name: The server name. + :vartype name: str + :ivar os_type: The OS type of the server. + :vartype os_type: str + :ivar agent_version: The version of the scout component on the server. + :vartype agent_version: str + :ivar last_heartbeat: The last heartbeat received from the server. + :vartype last_heartbeat: ~datetime.datetime + :ivar version_status: Version status. + :vartype version_status: str + :ivar retention_volumes: The retention volumes of Master target Server. + :vartype retention_volumes: + list[~azure.mgmt.recoveryservicessiterecovery.models.RetentionVolume] + :ivar data_stores: The list of data stores in the fabric. + :vartype data_stores: list[~azure.mgmt.recoveryservicessiterecovery.models.DataStore] + :ivar validation_errors: Validation errors. + :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar health_errors: Health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar disk_count: Disk count of the master target. + :vartype disk_count: int + :ivar os_version: OS Version of the master target. + :vartype os_version: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar mars_agent_version: MARS agent version. + :vartype mars_agent_version: str + :ivar mars_agent_expiry_date: MARS agent expiry date. + :vartype mars_agent_expiry_date: ~datetime.datetime + :ivar agent_version_details: Agent version details. + :vartype agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + :ivar mars_agent_version_details: Mars agent version details. + :vartype mars_agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'version_status': {'key': 'versionStatus', 'type': 'str'}, - 'retention_volumes': {'key': 'retentionVolumes', 'type': '[RetentionVolume]'}, - 'data_stores': {'key': 'dataStores', 'type': '[DataStore]'}, - 'validation_errors': {'key': 'validationErrors', 'type': '[HealthError]'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'disk_count': {'key': 'diskCount', 'type': 'int'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'mars_agent_version': {'key': 'marsAgentVersion', 'type': 'str'}, - 'mars_agent_expiry_date': {'key': 'marsAgentExpiryDate', 'type': 'iso-8601'}, - 'agent_version_details': {'key': 'agentVersionDetails', 'type': 'VersionDetails'}, - 'mars_agent_version_details': {'key': 'marsAgentVersionDetails', 'type': 'VersionDetails'}, + "id": {"key": "id", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "agent_version": {"key": "agentVersion", "type": "str"}, + "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, + "version_status": {"key": "versionStatus", "type": "str"}, + "retention_volumes": {"key": "retentionVolumes", "type": "[RetentionVolume]"}, + "data_stores": {"key": "dataStores", "type": "[DataStore]"}, + "validation_errors": {"key": "validationErrors", "type": "[HealthError]"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, + "disk_count": {"key": "diskCount", "type": "int"}, + "os_version": {"key": "osVersion", "type": "str"}, + "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, + "mars_agent_version": {"key": "marsAgentVersion", "type": "str"}, + "mars_agent_expiry_date": {"key": "marsAgentExpiryDate", "type": "iso-8601"}, + "agent_version_details": {"key": "agentVersionDetails", "type": "VersionDetails"}, + "mars_agent_version_details": {"key": "marsAgentVersionDetails", "type": "VersionDetails"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin ip_address: Optional[str] = None, name: Optional[str] = None, os_type: Optional[str] = None, agent_version: Optional[str] = None, last_heartbeat: Optional[datetime.datetime] = None, version_status: Optional[str] = None, - retention_volumes: Optional[List["RetentionVolume"]] = None, - data_stores: Optional[List["DataStore"]] = None, - validation_errors: Optional[List["HealthError"]] = None, - health_errors: Optional[List["HealthError"]] = None, + retention_volumes: Optional[List["_models.RetentionVolume"]] = None, + data_stores: Optional[List["_models.DataStore"]] = None, + validation_errors: Optional[List["_models.HealthError"]] = None, + health_errors: Optional[List["_models.HealthError"]] = None, disk_count: Optional[int] = None, os_version: Optional[str] = None, agent_expiry_date: Optional[datetime.datetime] = None, mars_agent_version: Optional[str] = None, mars_agent_expiry_date: Optional[datetime.datetime] = None, - agent_version_details: Optional["VersionDetails"] = None, - mars_agent_version_details: Optional["VersionDetails"] = None, - **kwargs - ): - super(MasterTargetServer, self).__init__(**kwargs) + agent_version_details: Optional["_models.VersionDetails"] = None, + mars_agent_version_details: Optional["_models.VersionDetails"] = None, + **kwargs + ): + """ + :keyword id: The server Id. + :paramtype id: str + :keyword ip_address: The IP address of the server. + :paramtype ip_address: str + :keyword name: The server name. + :paramtype name: str + :keyword os_type: The OS type of the server. + :paramtype os_type: str + :keyword agent_version: The version of the scout component on the server. + :paramtype agent_version: str + :keyword last_heartbeat: The last heartbeat received from the server. + :paramtype last_heartbeat: ~datetime.datetime + :keyword version_status: Version status. + :paramtype version_status: str + :keyword retention_volumes: The retention volumes of Master target Server. + :paramtype retention_volumes: + list[~azure.mgmt.recoveryservicessiterecovery.models.RetentionVolume] + :keyword data_stores: The list of data stores in the fabric. + :paramtype data_stores: list[~azure.mgmt.recoveryservicessiterecovery.models.DataStore] + :keyword validation_errors: Validation errors. + :paramtype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword health_errors: Health errors. + :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword disk_count: Disk count of the master target. + :paramtype disk_count: int + :keyword os_version: OS Version of the master target. + :paramtype os_version: str + :keyword agent_expiry_date: Agent expiry date. + :paramtype agent_expiry_date: ~datetime.datetime + :keyword mars_agent_version: MARS agent version. + :paramtype mars_agent_version: str + :keyword mars_agent_expiry_date: MARS agent expiry date. + :paramtype mars_agent_expiry_date: ~datetime.datetime + :keyword agent_version_details: Agent version details. + :paramtype agent_version_details: + ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + :keyword mars_agent_version_details: Mars agent version details. + :paramtype mars_agent_version_details: + ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + """ + super().__init__(**kwargs) self.id = id self.ip_address = ip_address self.name = name @@ -14124,90 +17882,85 @@ def __init__( self.mars_agent_version_details = mars_agent_version_details -class MigrateInput(msrest.serialization.Model): +class MigrateInput(_serialization.Model): """Input for migrate. All required parameters must be populated in order to send to Azure. - :param properties: Required. Migrate input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInputProperties + :ivar properties: Migrate input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'MigrateInputProperties'}, + "properties": {"key": "properties", "type": "MigrateInputProperties"}, } - def __init__( - self, - *, - properties: "MigrateInputProperties", - **kwargs - ): - super(MigrateInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.MigrateInputProperties", **kwargs): + """ + :keyword properties: Migrate input properties. Required. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class MigrateInputProperties(msrest.serialization.Model): +class MigrateInputProperties(_serialization.Model): """Migrate input properties. All required parameters must be populated in order to send to Azure. - :param provider_specific_details: Required. The provider specific details. - :type provider_specific_details: + :ivar provider_specific_details: The provider specific details. Required. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateProviderSpecificInput """ _validation = { - 'provider_specific_details': {'required': True}, + "provider_specific_details": {"required": True}, } _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'MigrateProviderSpecificInput'}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "MigrateProviderSpecificInput"}, } - def __init__( - self, - *, - provider_specific_details: "MigrateProviderSpecificInput", - **kwargs - ): - super(MigrateInputProperties, self).__init__(**kwargs) + def __init__(self, *, provider_specific_details: "_models.MigrateProviderSpecificInput", **kwargs): + """ + :keyword provider_specific_details: The provider specific details. Required. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.MigrateProviderSpecificInput + """ + super().__init__(**kwargs) self.provider_specific_details = provider_specific_details -class MigrateProviderSpecificInput(msrest.serialization.Model): +class MigrateProviderSpecificInput(_serialization.Model): """Migrate provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtMigrateInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtMigrateInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtMigrateInput'} - } + _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtMigrateInput"}} - def __init__( - self, - **kwargs - ): - super(MigrateProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -14222,64 +17975,72 @@ class MigrationItem(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The migration item properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The migration item properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MigrationItemProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "MigrationItemProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["MigrationItemProperties"] = None, + properties: Optional["_models.MigrationItemProperties"] = None, **kwargs ): - super(MigrationItem, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The migration item properties. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class MigrationItemCollection(msrest.serialization.Model): +class MigrationItemCollection(_serialization.Model): """Migration item collection. - :param value: The list of migration items. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The list of migration items. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MigrationItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["MigrationItem"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.MigrationItem"]] = None, next_link: Optional[str] = None, **kwargs ): - super(MigrationItemCollection, self).__init__(**kwargs) + """ + :keyword value: The list of migration items. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class MigrationItemProperties(msrest.serialization.Model): +class MigrationItemProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Migration item properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -14290,10 +18051,16 @@ class MigrationItemProperties(msrest.serialization.Model): :vartype policy_id: str :ivar policy_friendly_name: The name of policy governing this item. :vartype policy_friendly_name: str - :ivar migration_state: The migration status. Possible values include: "None", + :ivar recovery_services_provider_id: The recovery services provider ARM Id. + :vartype recovery_services_provider_id: str + :ivar replication_status: The replication status. + :vartype replication_status: str + :ivar migration_state: The migration status. Known values are: "None", "EnableMigrationInProgress", "EnableMigrationFailed", "DisableMigrationInProgress", "DisableMigrationFailed", "InitialSeedingInProgress", "InitialSeedingFailed", "Replicating", - "MigrationInProgress", "MigrationSucceeded", "MigrationFailed". + "MigrationInProgress", "MigrationSucceeded", "MigrationFailed", "ResumeInProgress", + "ResumeInitiated", "SuspendingProtection", "ProtectionSuspended", + "MigrationCompletedWithInformation", and "MigrationPartiallySucceeded". :vartype migration_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.MigrationState :ivar migration_state_description: The migration state description. :vartype migration_state_description: str @@ -14301,14 +18068,19 @@ class MigrationItemProperties(msrest.serialization.Model): :vartype last_test_migration_time: ~datetime.datetime :ivar last_test_migration_status: The status of the last test migration. :vartype last_test_migration_status: str - :ivar test_migrate_state: The test migrate state. Possible values include: "None", + :ivar last_migration_time: The last migration time. + :vartype last_migration_time: ~datetime.datetime + :ivar last_migration_status: The status of the last migration. + :vartype last_migration_status: str + :ivar test_migrate_state: The test migrate state. Known values are: "None", "TestMigrationInProgress", "TestMigrationSucceeded", "TestMigrationFailed", - "TestMigrationCleanupInProgress". + "TestMigrationCleanupInProgress", "TestMigrationCompletedWithInformation", and + "TestMigrationPartiallySucceeded". :vartype test_migrate_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrationState :ivar test_migrate_state_description: The test migrate state description. :vartype test_migrate_state_description: str - :ivar health: The consolidated health. Possible values include: "None", "Normal", "Warning", + :ivar health: The consolidated health. Known values are: "None", "Normal", "Warning", and "Critical". :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth :ivar health_errors: The list of health errors. @@ -14319,87 +18091,107 @@ class MigrationItemProperties(msrest.serialization.Model): ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemOperation] :ivar current_job: The current job details. :vartype current_job: ~azure.mgmt.recoveryservicessiterecovery.models.CurrentJobDetails + :ivar critical_job_history: The critical past job details. + :vartype critical_job_history: + list[~azure.mgmt.recoveryservicessiterecovery.models.CriticalJobHistoryDetails] :ivar event_correlation_id: The correlation Id for events associated with this migration item. :vartype event_correlation_id: str - :param provider_specific_details: The migration provider custom settings. - :type provider_specific_details: + :ivar provider_specific_details: The migration provider custom settings. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationProviderSpecificSettings """ _validation = { - 'machine_name': {'readonly': True}, - 'policy_id': {'readonly': True}, - 'policy_friendly_name': {'readonly': True}, - 'migration_state': {'readonly': True}, - 'migration_state_description': {'readonly': True}, - 'last_test_migration_time': {'readonly': True}, - 'last_test_migration_status': {'readonly': True}, - 'test_migrate_state': {'readonly': True}, - 'test_migrate_state_description': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - 'allowed_operations': {'readonly': True}, - 'current_job': {'readonly': True}, - 'event_correlation_id': {'readonly': True}, - } - - _attribute_map = { - 'machine_name': {'key': 'machineName', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'policy_friendly_name': {'key': 'policyFriendlyName', 'type': 'str'}, - 'migration_state': {'key': 'migrationState', 'type': 'str'}, - 'migration_state_description': {'key': 'migrationStateDescription', 'type': 'str'}, - 'last_test_migration_time': {'key': 'lastTestMigrationTime', 'type': 'iso-8601'}, - 'last_test_migration_status': {'key': 'lastTestMigrationStatus', 'type': 'str'}, - 'test_migrate_state': {'key': 'testMigrateState', 'type': 'str'}, - 'test_migrate_state_description': {'key': 'testMigrateStateDescription', 'type': 'str'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'allowed_operations': {'key': 'allowedOperations', 'type': '[str]'}, - 'current_job': {'key': 'currentJob', 'type': 'CurrentJobDetails'}, - 'event_correlation_id': {'key': 'eventCorrelationId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'MigrationProviderSpecificSettings'}, - } - - def __init__( - self, - *, - provider_specific_details: Optional["MigrationProviderSpecificSettings"] = None, - **kwargs - ): - super(MigrationItemProperties, self).__init__(**kwargs) + "machine_name": {"readonly": True}, + "policy_id": {"readonly": True}, + "policy_friendly_name": {"readonly": True}, + "recovery_services_provider_id": {"readonly": True}, + "replication_status": {"readonly": True}, + "migration_state": {"readonly": True}, + "migration_state_description": {"readonly": True}, + "last_test_migration_time": {"readonly": True}, + "last_test_migration_status": {"readonly": True}, + "last_migration_time": {"readonly": True}, + "last_migration_status": {"readonly": True}, + "test_migrate_state": {"readonly": True}, + "test_migrate_state_description": {"readonly": True}, + "health": {"readonly": True}, + "health_errors": {"readonly": True}, + "allowed_operations": {"readonly": True}, + "current_job": {"readonly": True}, + "critical_job_history": {"readonly": True}, + "event_correlation_id": {"readonly": True}, + } + + _attribute_map = { + "machine_name": {"key": "machineName", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "policy_friendly_name": {"key": "policyFriendlyName", "type": "str"}, + "recovery_services_provider_id": {"key": "recoveryServicesProviderId", "type": "str"}, + "replication_status": {"key": "replicationStatus", "type": "str"}, + "migration_state": {"key": "migrationState", "type": "str"}, + "migration_state_description": {"key": "migrationStateDescription", "type": "str"}, + "last_test_migration_time": {"key": "lastTestMigrationTime", "type": "iso-8601"}, + "last_test_migration_status": {"key": "lastTestMigrationStatus", "type": "str"}, + "last_migration_time": {"key": "lastMigrationTime", "type": "iso-8601"}, + "last_migration_status": {"key": "lastMigrationStatus", "type": "str"}, + "test_migrate_state": {"key": "testMigrateState", "type": "str"}, + "test_migrate_state_description": {"key": "testMigrateStateDescription", "type": "str"}, + "health": {"key": "health", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, + "allowed_operations": {"key": "allowedOperations", "type": "[str]"}, + "current_job": {"key": "currentJob", "type": "CurrentJobDetails"}, + "critical_job_history": {"key": "criticalJobHistory", "type": "[CriticalJobHistoryDetails]"}, + "event_correlation_id": {"key": "eventCorrelationId", "type": "str"}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "MigrationProviderSpecificSettings"}, + } + + def __init__( + self, *, provider_specific_details: Optional["_models.MigrationProviderSpecificSettings"] = None, **kwargs + ): + """ + :keyword provider_specific_details: The migration provider custom settings. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.MigrationProviderSpecificSettings + """ + super().__init__(**kwargs) self.machine_name = None self.policy_id = None self.policy_friendly_name = None + self.recovery_services_provider_id = None + self.replication_status = None self.migration_state = None self.migration_state_description = None self.last_test_migration_time = None self.last_test_migration_status = None + self.last_migration_time = None + self.last_migration_status = None self.test_migrate_state = None self.test_migrate_state_description = None self.health = None self.health_errors = None self.allowed_operations = None self.current_job = None + self.critical_job_history = None self.event_correlation_id = None self.provider_specific_details = provider_specific_details -class MigrationItemsQueryParameter(msrest.serialization.Model): +class MigrationItemsQueryParameter(_serialization.Model): """Query parameter to enumerate migration items. - :param source_fabric_name: The source fabric name filter. - :type source_fabric_name: str - :param source_container_name: The source container name filter. - :type source_container_name: str - :param instance_type: The replication provider type. - :type instance_type: str + :ivar source_fabric_name: The source fabric name filter. + :vartype source_fabric_name: str + :ivar source_container_name: The source container name filter. + :vartype source_container_name: str + :ivar instance_type: The replication provider type. + :vartype instance_type: str """ _attribute_map = { - 'source_fabric_name': {'key': 'sourceFabricName', 'type': 'str'}, - 'source_container_name': {'key': 'sourceContainerName', 'type': 'str'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "source_fabric_name": {"key": "sourceFabricName", "type": "str"}, + "source_container_name": {"key": "sourceContainerName", "type": "str"}, + "instance_type": {"key": "instanceType", "type": "str"}, } def __init__( @@ -14410,41 +18202,45 @@ def __init__( instance_type: Optional[str] = None, **kwargs ): - super(MigrationItemsQueryParameter, self).__init__(**kwargs) + """ + :keyword source_fabric_name: The source fabric name filter. + :paramtype source_fabric_name: str + :keyword source_container_name: The source container name filter. + :paramtype source_container_name: str + :keyword instance_type: The replication provider type. + :paramtype instance_type: str + """ + super().__init__(**kwargs) self.source_fabric_name = source_fabric_name self.source_container_name = source_container_name self.instance_type = instance_type -class MigrationProviderSpecificSettings(msrest.serialization.Model): +class MigrationProviderSpecificSettings(_serialization.Model): """Migration provider specific settings. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtMigrationDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtMigrationDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtMigrationDetails'} - } + _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtMigrationDetails"}} - def __init__( - self, - **kwargs - ): - super(MigrationProviderSpecificSettings, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -14459,111 +18255,122 @@ class MigrationRecoveryPoint(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Recovery point properties. - :type properties: + :ivar location: Resource Location. + :vartype location: str + :ivar properties: Recovery point properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MigrationRecoveryPointProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "MigrationRecoveryPointProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["MigrationRecoveryPointProperties"] = None, + properties: Optional["_models.MigrationRecoveryPointProperties"] = None, **kwargs ): - super(MigrationRecoveryPoint, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: Recovery point properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class MigrationRecoveryPointCollection(msrest.serialization.Model): +class MigrationRecoveryPointCollection(_serialization.Model): """Collection of migration recovery points. - :param value: The migration recovery point details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The migration recovery point details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[MigrationRecoveryPoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MigrationRecoveryPoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["MigrationRecoveryPoint"]] = None, + value: Optional[List["_models.MigrationRecoveryPoint"]] = None, next_link: Optional[str] = None, **kwargs ): - super(MigrationRecoveryPointCollection, self).__init__(**kwargs) + """ + :keyword value: The migration recovery point details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class MigrationRecoveryPointProperties(msrest.serialization.Model): +class MigrationRecoveryPointProperties(_serialization.Model): """Migration item recovery point properties. Variables are only populated by the server, and will be ignored when sending a request. :ivar recovery_point_time: The recovery point time. :vartype recovery_point_time: ~datetime.datetime - :ivar recovery_point_type: The recovery point type. Possible values include: "NotSpecified", - "ApplicationConsistent", "CrashConsistent". + :ivar recovery_point_type: The recovery point type. Known values are: "NotSpecified", + "ApplicationConsistent", and "CrashConsistent". :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointType """ _validation = { - 'recovery_point_time': {'readonly': True}, - 'recovery_point_type': {'readonly': True}, + "recovery_point_time": {"readonly": True}, + "recovery_point_type": {"readonly": True}, } _attribute_map = { - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(MigrationRecoveryPointProperties, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.recovery_point_time = None self.recovery_point_type = None -class MobilityServiceUpdate(msrest.serialization.Model): +class MobilityServiceUpdate(_serialization.Model): """The Mobility Service update details. - :param version: The version of the latest update. - :type version: str - :param reboot_status: The reboot status of the update - whether it is required or not. - :type reboot_status: str - :param os_type: The OS type. - :type os_type: str + :ivar version: The version of the latest update. + :vartype version: str + :ivar reboot_status: The reboot status of the update - whether it is required or not. + :vartype reboot_status: str + :ivar os_type: The OS type. + :vartype os_type: str """ _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'reboot_status': {'key': 'rebootStatus', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, + "version": {"key": "version", "type": "str"}, + "reboot_status": {"key": "rebootStatus", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, } def __init__( @@ -14574,7 +18381,15 @@ def __init__( os_type: Optional[str] = None, **kwargs ): - super(MobilityServiceUpdate, self).__init__(**kwargs) + """ + :keyword version: The version of the latest update. + :paramtype version: str + :keyword reboot_status: The reboot status of the update - whether it is required or not. + :paramtype reboot_status: str + :keyword os_type: The OS type. + :paramtype os_type: str + """ + super().__init__(**kwargs) self.version = version self.reboot_status = reboot_status self.os_type = os_type @@ -14591,59 +18406,61 @@ class Network(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The Network Properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The Network Properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'NetworkProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "NetworkProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["NetworkProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.NetworkProperties"] = None, **kwargs ): - super(Network, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The Network Properties. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class NetworkCollection(msrest.serialization.Model): +class NetworkCollection(_serialization.Model): """List of networks. - :param value: The Networks list details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Network] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The Networks list details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Network]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Network]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["Network"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(NetworkCollection, self).__init__(**kwargs) + def __init__(self, *, value: Optional[List["_models.Network"]] = None, next_link: Optional[str] = None, **kwargs): + """ + :keyword value: The Networks list details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -14659,97 +18476,105 @@ class NetworkMapping(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The Network Mapping Properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The Network Mapping Properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'NetworkMappingProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "NetworkMappingProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["NetworkMappingProperties"] = None, + properties: Optional["_models.NetworkMappingProperties"] = None, **kwargs ): - super(NetworkMapping, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The Network Mapping Properties. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class NetworkMappingCollection(msrest.serialization.Model): +class NetworkMappingCollection(_serialization.Model): """List of network mappings. As with NetworkMapping, it should be possible to reuse a prev version of this class. It doesn't seem likely this class could be anything more than a slightly bespoke collection of NetworkMapping. Hence it makes sense to override Load with Base.NetworkMapping instead of existing CurrentVersion.NetworkMapping. - :param value: The Network Mappings list. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The Network Mappings list. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkMapping]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[NetworkMapping]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["NetworkMapping"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.NetworkMapping"]] = None, next_link: Optional[str] = None, **kwargs ): - super(NetworkMappingCollection, self).__init__(**kwargs) + """ + :keyword value: The Network Mappings list. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class NetworkMappingProperties(msrest.serialization.Model): +class NetworkMappingProperties(_serialization.Model): """Network Mapping Properties. - :param state: The pairing state for network mapping. - :type state: str - :param primary_network_friendly_name: The primary network friendly name. - :type primary_network_friendly_name: str - :param primary_network_id: The primary network id for network mapping. - :type primary_network_id: str - :param primary_fabric_friendly_name: The primary fabric friendly name. - :type primary_fabric_friendly_name: str - :param recovery_network_friendly_name: The recovery network friendly name. - :type recovery_network_friendly_name: str - :param recovery_network_id: The recovery network id for network mapping. - :type recovery_network_id: str - :param recovery_fabric_arm_id: The recovery fabric ARM id. - :type recovery_fabric_arm_id: str - :param recovery_fabric_friendly_name: The recovery fabric friendly name. - :type recovery_fabric_friendly_name: str - :param fabric_specific_settings: The fabric specific settings. - :type fabric_specific_settings: + :ivar state: The pairing state for network mapping. + :vartype state: str + :ivar primary_network_friendly_name: The primary network friendly name. + :vartype primary_network_friendly_name: str + :ivar primary_network_id: The primary network id for network mapping. + :vartype primary_network_id: str + :ivar primary_fabric_friendly_name: The primary fabric friendly name. + :vartype primary_fabric_friendly_name: str + :ivar recovery_network_friendly_name: The recovery network friendly name. + :vartype recovery_network_friendly_name: str + :ivar recovery_network_id: The recovery network id for network mapping. + :vartype recovery_network_id: str + :ivar recovery_fabric_arm_id: The recovery fabric ARM id. + :vartype recovery_fabric_arm_id: str + :ivar recovery_fabric_friendly_name: The recovery fabric friendly name. + :vartype recovery_fabric_friendly_name: str + :ivar fabric_specific_settings: The fabric specific settings. + :vartype fabric_specific_settings: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings """ _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - 'primary_network_friendly_name': {'key': 'primaryNetworkFriendlyName', 'type': 'str'}, - 'primary_network_id': {'key': 'primaryNetworkId', 'type': 'str'}, - 'primary_fabric_friendly_name': {'key': 'primaryFabricFriendlyName', 'type': 'str'}, - 'recovery_network_friendly_name': {'key': 'recoveryNetworkFriendlyName', 'type': 'str'}, - 'recovery_network_id': {'key': 'recoveryNetworkId', 'type': 'str'}, - 'recovery_fabric_arm_id': {'key': 'recoveryFabricArmId', 'type': 'str'}, - 'recovery_fabric_friendly_name': {'key': 'recoveryFabricFriendlyName', 'type': 'str'}, - 'fabric_specific_settings': {'key': 'fabricSpecificSettings', 'type': 'NetworkMappingFabricSpecificSettings'}, + "state": {"key": "state", "type": "str"}, + "primary_network_friendly_name": {"key": "primaryNetworkFriendlyName", "type": "str"}, + "primary_network_id": {"key": "primaryNetworkId", "type": "str"}, + "primary_fabric_friendly_name": {"key": "primaryFabricFriendlyName", "type": "str"}, + "recovery_network_friendly_name": {"key": "recoveryNetworkFriendlyName", "type": "str"}, + "recovery_network_id": {"key": "recoveryNetworkId", "type": "str"}, + "recovery_fabric_arm_id": {"key": "recoveryFabricArmId", "type": "str"}, + "recovery_fabric_friendly_name": {"key": "recoveryFabricFriendlyName", "type": "str"}, + "fabric_specific_settings": {"key": "fabricSpecificSettings", "type": "NetworkMappingFabricSpecificSettings"}, } def __init__( @@ -14763,10 +18588,31 @@ def __init__( recovery_network_id: Optional[str] = None, recovery_fabric_arm_id: Optional[str] = None, recovery_fabric_friendly_name: Optional[str] = None, - fabric_specific_settings: Optional["NetworkMappingFabricSpecificSettings"] = None, - **kwargs - ): - super(NetworkMappingProperties, self).__init__(**kwargs) + fabric_specific_settings: Optional["_models.NetworkMappingFabricSpecificSettings"] = None, + **kwargs + ): + """ + :keyword state: The pairing state for network mapping. + :paramtype state: str + :keyword primary_network_friendly_name: The primary network friendly name. + :paramtype primary_network_friendly_name: str + :keyword primary_network_id: The primary network id for network mapping. + :paramtype primary_network_id: str + :keyword primary_fabric_friendly_name: The primary fabric friendly name. + :paramtype primary_fabric_friendly_name: str + :keyword recovery_network_friendly_name: The recovery network friendly name. + :paramtype recovery_network_friendly_name: str + :keyword recovery_network_id: The recovery network id for network mapping. + :paramtype recovery_network_id: str + :keyword recovery_fabric_arm_id: The recovery fabric ARM id. + :paramtype recovery_fabric_arm_id: str + :keyword recovery_fabric_friendly_name: The recovery fabric friendly name. + :paramtype recovery_fabric_friendly_name: str + :keyword fabric_specific_settings: The fabric specific settings. + :paramtype fabric_specific_settings: + ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings + """ + super().__init__(**kwargs) self.state = state self.primary_network_friendly_name = primary_network_friendly_name self.primary_network_id = primary_network_id @@ -14778,36 +18624,46 @@ def __init__( self.fabric_specific_settings = fabric_specific_settings -class NetworkProperties(msrest.serialization.Model): +class NetworkProperties(_serialization.Model): """Network Properties. - :param fabric_type: The Fabric Type. - :type fabric_type: str - :param subnets: The List of subnets. - :type subnets: list[~azure.mgmt.recoveryservicessiterecovery.models.Subnet] - :param friendly_name: The Friendly Name. - :type friendly_name: str - :param network_type: The Network Type. - :type network_type: str + :ivar fabric_type: The Fabric Type. + :vartype fabric_type: str + :ivar subnets: The List of subnets. + :vartype subnets: list[~azure.mgmt.recoveryservicessiterecovery.models.Subnet] + :ivar friendly_name: The Friendly Name. + :vartype friendly_name: str + :ivar network_type: The Network Type. + :vartype network_type: str """ _attribute_map = { - 'fabric_type': {'key': 'fabricType', 'type': 'str'}, - 'subnets': {'key': 'subnets', 'type': '[Subnet]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'network_type': {'key': 'networkType', 'type': 'str'}, + "fabric_type": {"key": "fabricType", "type": "str"}, + "subnets": {"key": "subnets", "type": "[Subnet]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "network_type": {"key": "networkType", "type": "str"}, } def __init__( self, *, fabric_type: Optional[str] = None, - subnets: Optional[List["Subnet"]] = None, + subnets: Optional[List["_models.Subnet"]] = None, friendly_name: Optional[str] = None, network_type: Optional[str] = None, **kwargs ): - super(NetworkProperties, self).__init__(**kwargs) + """ + :keyword fabric_type: The Fabric Type. + :paramtype fabric_type: str + :keyword subnets: The List of subnets. + :paramtype subnets: list[~azure.mgmt.recoveryservicessiterecovery.models.Subnet] + :keyword friendly_name: The Friendly Name. + :paramtype friendly_name: str + :keyword network_type: The Network Type. + :paramtype network_type: str + """ + super().__init__(**kwargs) self.fabric_type = fabric_type self.subnets = subnets self.friendly_name = friendly_name @@ -14819,51 +18675,68 @@ class NewProtectionProfile(ProtectionProfileCustomDetails): All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param policy_name: Required. The protection profile input. - :type policy_name: str - :param recovery_point_history: The duration in minutes until which the recovery points need to + :ivar resource_type: The class type. Required. + :vartype resource_type: str + :ivar policy_name: The protection profile input. Required. + :vartype policy_name: str + :ivar recovery_point_history: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + :vartype recovery_point_history: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int - :param multi_vm_sync_status: Required. A value indicating whether multi-VM sync has to be - enabled. Value should be 'Enabled' or 'Disabled'. Possible values include: "Enable", "Disable". - :type multi_vm_sync_status: str or + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value + should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :vartype multi_vm_sync_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus """ _validation = { - 'resource_type': {'required': True}, - 'policy_name': {'required': True}, - 'multi_vm_sync_status': {'required': True}, + "resource_type": {"required": True}, + "policy_name": {"required": True}, + "multi_vm_sync_status": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'recovery_point_history': {'key': 'recoveryPointHistory', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'multi_vm_sync_status': {'key': 'multiVmSyncStatus', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "policy_name": {"key": "policyName", "type": "str"}, + "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, } def __init__( self, *, policy_name: str, - multi_vm_sync_status: Union[str, "SetMultiVmSyncStatus"], + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], recovery_point_history: Optional[int] = None, crash_consistent_frequency_in_minutes: Optional[int] = None, app_consistent_frequency_in_minutes: Optional[int] = None, **kwargs ): - super(NewProtectionProfile, self).__init__(**kwargs) - self.resource_type = 'New' # type: str + """ + :keyword policy_name: The protection profile input. Required. + :paramtype policy_name: str + :keyword recovery_point_history: The duration in minutes until which the recovery points need + to be stored. + :paramtype recovery_point_history: int + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :paramtype crash_consistent_frequency_in_minutes: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in + minutes). + :paramtype app_consistent_frequency_in_minutes: int + :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + Value should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :paramtype multi_vm_sync_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus + """ + super().__init__(**kwargs) + self.resource_type = "New" # type: str self.policy_name = policy_name self.recovery_point_history = recovery_point_history self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes @@ -14876,24 +18749,27 @@ class NewRecoveryVirtualNetwork(RecoveryVirtualNetworkCustomDetails): All required parameters must be populated in order to send to Azure. - :param resource_type: Required. The class type.Constant filled by server. - :type resource_type: str - :param recovery_virtual_network_resource_group_name: The name of the resource group to be used + :ivar resource_type: The class type. Required. + :vartype resource_type: str + :ivar recovery_virtual_network_resource_group_name: The name of the resource group to be used to create the recovery virtual network. If absent, target network would be created in the same resource group as target VM. - :type recovery_virtual_network_resource_group_name: str - :param recovery_virtual_network_name: The recovery virtual network name. - :type recovery_virtual_network_name: str + :vartype recovery_virtual_network_resource_group_name: str + :ivar recovery_virtual_network_name: The recovery virtual network name. + :vartype recovery_virtual_network_name: str """ _validation = { - 'resource_type': {'required': True}, + "resource_type": {"required": True}, } _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'recovery_virtual_network_resource_group_name': {'key': 'recoveryVirtualNetworkResourceGroupName', 'type': 'str'}, - 'recovery_virtual_network_name': {'key': 'recoveryVirtualNetworkName', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "recovery_virtual_network_resource_group_name": { + "key": "recoveryVirtualNetworkResourceGroupName", + "type": "str", + }, + "recovery_virtual_network_name": {"key": "recoveryVirtualNetworkName", "type": "str"}, } def __init__( @@ -14903,16 +18779,24 @@ def __init__( recovery_virtual_network_name: Optional[str] = None, **kwargs ): - super(NewRecoveryVirtualNetwork, self).__init__(**kwargs) - self.resource_type = 'New' # type: str + """ + :keyword recovery_virtual_network_resource_group_name: The name of the resource group to be + used to create the recovery virtual network. If absent, target network would be created in the + same resource group as target VM. + :paramtype recovery_virtual_network_resource_group_name: str + :keyword recovery_virtual_network_name: The recovery virtual network name. + :paramtype recovery_virtual_network_name: str + """ + super().__init__(**kwargs) + self.resource_type = "New" # type: str self.recovery_virtual_network_resource_group_name = recovery_virtual_network_resource_group_name self.recovery_virtual_network_name = recovery_virtual_network_name -class OperationsDiscovery(msrest.serialization.Model): +class OperationsDiscovery(_serialization.Model): """Operations discovery class. - :param name: Name of the API. The name of the operation being performed on this particular + :ivar name: Name of the API. The name of the operation being performed on this particular object. It should match the action name that appears in RBAC / the event service. Examples of operations include: * Microsoft.Compute/virtualMachine/capture/action * Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * @@ -14925,89 +18809,114 @@ class OperationsDiscovery(msrest.serialization.Model): include the "{Resource Provider Namespace}/register/action" operation in their response. This API is used to register for their service, and should include details about the operation (e.g. a localized name for the resource provider + any special considerations like PII release). - :type name: str - :param display: Object type. - :type display: ~azure.mgmt.recoveryservicessiterecovery.models.Display - :param origin: Origin. The intended executor of the operation; governs the display of the + :vartype name: str + :ivar display: Object type. + :vartype display: ~azure.mgmt.recoveryservicessiterecovery.models.Display + :ivar origin: Origin. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. Default value is "user,system". - :type origin: str - :param properties: Properties. Reserved for future use. - :type properties: any + :vartype origin: str + :ivar properties: Properties. Reserved for future use. + :vartype properties: JSON """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'Display'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "Display"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, } def __init__( self, *, name: Optional[str] = None, - display: Optional["Display"] = None, + display: Optional["_models.Display"] = None, origin: Optional[str] = None, - properties: Optional[Any] = None, - **kwargs - ): - super(OperationsDiscovery, self).__init__(**kwargs) + properties: Optional[JSON] = None, + **kwargs + ): + """ + :keyword name: Name of the API. The name of the operation being performed on this particular + object. It should match the action name that appears in RBAC / the event service. Examples of + operations include: * Microsoft.Compute/virtualMachine/capture/action * + Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * + Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action + should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the + action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or + Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, + Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be + used. If it is a POST, Action should be used. As a note: all resource providers would need to + include the "{Resource Provider Namespace}/register/action" operation in their response. This + API is used to register for their service, and should include details about the operation (e.g. + a localized name for the resource provider + any special considerations like PII release). + :paramtype name: str + :keyword display: Object type. + :paramtype display: ~azure.mgmt.recoveryservicessiterecovery.models.Display + :keyword origin: Origin. The intended executor of the operation; governs the display of the + operation in the RBAC UX and the audit logs UX. Default value is "user,system". + :paramtype origin: str + :keyword properties: Properties. Reserved for future use. + :paramtype properties: JSON + """ + super().__init__(**kwargs) self.name = name self.display = display self.origin = origin self.properties = properties -class OperationsDiscoveryCollection(msrest.serialization.Model): +class OperationsDiscoveryCollection(_serialization.Model): """Collection of ClientDiscovery details. - :param value: The ClientDiscovery details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The ClientDiscovery details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationsDiscovery]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OperationsDiscovery]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["OperationsDiscovery"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.OperationsDiscovery"]] = None, next_link: Optional[str] = None, **kwargs ): - super(OperationsDiscoveryCollection, self).__init__(**kwargs) + """ + :keyword value: The ClientDiscovery details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class OSDetails(msrest.serialization.Model): +class OSDetails(_serialization.Model): """Disk Details. - :param os_type: VM Disk details. - :type os_type: str - :param product_type: Product type. - :type product_type: str - :param os_edition: The OSEdition. - :type os_edition: str - :param o_s_version: The OS Version. - :type o_s_version: str - :param o_s_major_version: The OS Major Version. - :type o_s_major_version: str - :param o_s_minor_version: The OS Minor Version. - :type o_s_minor_version: str + :ivar os_type: VM Disk details. + :vartype os_type: str + :ivar product_type: Product type. + :vartype product_type: str + :ivar os_edition: The OSEdition. + :vartype os_edition: str + :ivar o_s_version: The OS Version. + :vartype o_s_version: str + :ivar o_s_major_version: The OS Major Version. + :vartype o_s_major_version: str + :ivar o_s_minor_version: The OS Minor Version. + :vartype o_s_minor_version: str """ _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'product_type': {'key': 'productType', 'type': 'str'}, - 'os_edition': {'key': 'osEdition', 'type': 'str'}, - 'o_s_version': {'key': 'oSVersion', 'type': 'str'}, - 'o_s_major_version': {'key': 'oSMajorVersion', 'type': 'str'}, - 'o_s_minor_version': {'key': 'oSMinorVersion', 'type': 'str'}, + "os_type": {"key": "osType", "type": "str"}, + "product_type": {"key": "productType", "type": "str"}, + "os_edition": {"key": "osEdition", "type": "str"}, + "o_s_version": {"key": "oSVersion", "type": "str"}, + "o_s_major_version": {"key": "oSMajorVersion", "type": "str"}, + "o_s_minor_version": {"key": "oSMinorVersion", "type": "str"}, } def __init__( @@ -15021,7 +18930,21 @@ def __init__( o_s_minor_version: Optional[str] = None, **kwargs ): - super(OSDetails, self).__init__(**kwargs) + """ + :keyword os_type: VM Disk details. + :paramtype os_type: str + :keyword product_type: Product type. + :paramtype product_type: str + :keyword os_edition: The OSEdition. + :paramtype os_edition: str + :keyword o_s_version: The OS Version. + :paramtype o_s_version: str + :keyword o_s_major_version: The OS Major Version. + :paramtype o_s_major_version: str + :keyword o_s_minor_version: The OS Minor Version. + :paramtype o_s_minor_version: str + """ + super().__init__(**kwargs) self.os_type = os_type self.product_type = product_type self.os_edition = os_edition @@ -15030,21 +18953,21 @@ def __init__( self.o_s_minor_version = o_s_minor_version -class OSDiskDetails(msrest.serialization.Model): +class OSDiskDetails(_serialization.Model): """Details of the OS Disk. - :param os_vhd_id: The id of the disk containing the OS. - :type os_vhd_id: str - :param os_type: The type of the OS on the VM. - :type os_type: str - :param vhd_name: The OS disk VHD name. - :type vhd_name: str + :ivar os_vhd_id: The id of the disk containing the OS. + :vartype os_vhd_id: str + :ivar os_type: The type of the OS on the VM. + :vartype os_type: str + :ivar vhd_name: The OS disk VHD name. + :vartype vhd_name: str """ _attribute_map = { - 'os_vhd_id': {'key': 'osVhdId', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vhd_name': {'key': 'vhdName', 'type': 'str'}, + "os_vhd_id": {"key": "osVhdId", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "vhd_name": {"key": "vhdName", "type": "str"}, } def __init__( @@ -15055,83 +18978,155 @@ def __init__( vhd_name: Optional[str] = None, **kwargs ): - super(OSDiskDetails, self).__init__(**kwargs) + """ + :keyword os_vhd_id: The id of the disk containing the OS. + :paramtype os_vhd_id: str + :keyword os_type: The type of the OS on the VM. + :paramtype os_type: str + :keyword vhd_name: The OS disk VHD name. + :paramtype vhd_name: str + """ + super().__init__(**kwargs) self.os_vhd_id = os_vhd_id self.os_type = os_type self.vhd_name = vhd_name -class OSVersionWrapper(msrest.serialization.Model): +class OSVersionWrapper(_serialization.Model): """Wrapper model for OSVersion to include version and service pack info. - :param version: The version. - :type version: str - :param service_pack: The service pack. - :type service_pack: str + :ivar version: The version. + :vartype version: str + :ivar service_pack: The service pack. + :vartype service_pack: str """ _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'service_pack': {'key': 'servicePack', 'type': 'str'}, + "version": {"key": "version", "type": "str"}, + "service_pack": {"key": "servicePack", "type": "str"}, } - def __init__( - self, - *, - version: Optional[str] = None, - service_pack: Optional[str] = None, - **kwargs - ): - super(OSVersionWrapper, self).__init__(**kwargs) + def __init__(self, *, version: Optional[str] = None, service_pack: Optional[str] = None, **kwargs): + """ + :keyword version: The version. + :paramtype version: str + :keyword service_pack: The service pack. + :paramtype service_pack: str + """ + super().__init__(**kwargs) self.version = version self.service_pack = service_pack -class PlannedFailoverInput(msrest.serialization.Model): +class PauseReplicationInput(_serialization.Model): + """Pause replication input. + + All required parameters must be populated in order to send to Azure. + + :ivar properties: Pause replication input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInputProperties + """ + + _validation = { + "properties": {"required": True}, + } + + _attribute_map = { + "properties": {"key": "properties", "type": "PauseReplicationInputProperties"}, + } + + def __init__(self, *, properties: "_models.PauseReplicationInputProperties", **kwargs): + """ + :keyword properties: Pause replication input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInputProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class PauseReplicationInputProperties(_serialization.Model): + """Pause replication input properties. + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: The class type. Required. + :vartype instance_type: str + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + } + + def __init__(self, *, instance_type: str, **kwargs): + """ + :keyword instance_type: The class type. Required. + :paramtype instance_type: str + """ + super().__init__(**kwargs) + self.instance_type = instance_type + + +class PlannedFailoverInput(_serialization.Model): """Input definition for planned failover. - :param properties: Planned failover input properties. - :type properties: + :ivar properties: Planned failover input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'PlannedFailoverInputProperties'}, + "properties": {"key": "properties", "type": "PlannedFailoverInputProperties"}, } - def __init__( - self, - *, - properties: Optional["PlannedFailoverInputProperties"] = None, - **kwargs - ): - super(PlannedFailoverInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.PlannedFailoverInputProperties"] = None, **kwargs): + """ + :keyword properties: Planned failover input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class PlannedFailoverInputProperties(msrest.serialization.Model): +class PlannedFailoverInputProperties(_serialization.Model): """Input definition for planned failover input properties. - :param failover_direction: Failover direction. - :type failover_direction: str - :param provider_specific_details: Provider specific settings. - :type provider_specific_details: + :ivar failover_direction: Failover direction. + :vartype failover_direction: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput """ _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'PlannedFailoverProviderSpecificFailoverInput'}, + "failover_direction": {"key": "failoverDirection", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "PlannedFailoverProviderSpecificFailoverInput", + }, } def __init__( self, *, failover_direction: Optional[str] = None, - provider_specific_details: Optional["PlannedFailoverProviderSpecificFailoverInput"] = None, + provider_specific_details: Optional["_models.PlannedFailoverProviderSpecificFailoverInput"] = None, **kwargs ): - super(PlannedFailoverInputProperties, self).__init__(**kwargs) + """ + :keyword failover_direction: Failover direction. + :paramtype failover_direction: str + :keyword provider_specific_details: Provider specific settings. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput + """ + super().__init__(**kwargs) self.failover_direction = failover_direction self.provider_specific_details = provider_specific_details @@ -15147,165 +19142,174 @@ class Policy(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The custom data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PolicyProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "PolicyProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["PolicyProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.PolicyProperties"] = None, **kwargs ): - super(Policy, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The custom data. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class PolicyCollection(msrest.serialization.Model): +class PolicyCollection(_serialization.Model): """Protection Profile Collection details. - :param value: The policy details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The policy details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Policy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Policy]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["Policy"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(PolicyCollection, self).__init__(**kwargs) + def __init__(self, *, value: Optional[List["_models.Policy"]] = None, next_link: Optional[str] = None, **kwargs): + """ + :keyword value: The policy details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class PolicyProperties(msrest.serialization.Model): +class PolicyProperties(_serialization.Model): """Protection profile custom data details. - :param friendly_name: The FriendlyName. - :type friendly_name: str - :param provider_specific_details: The ReplicationChannelSetting. - :type provider_specific_details: + :ivar friendly_name: The FriendlyName. + :vartype friendly_name: str + :ivar provider_specific_details: The ReplicationChannelSetting. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails """ _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'PolicyProviderSpecificDetails'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "PolicyProviderSpecificDetails"}, } def __init__( self, *, friendly_name: Optional[str] = None, - provider_specific_details: Optional["PolicyProviderSpecificDetails"] = None, + provider_specific_details: Optional["_models.PolicyProviderSpecificDetails"] = None, **kwargs ): - super(PolicyProperties, self).__init__(**kwargs) + """ + :keyword friendly_name: The FriendlyName. + :paramtype friendly_name: str + :keyword provider_specific_details: The ReplicationChannelSetting. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.provider_specific_details = provider_specific_details -class ProcessServer(msrest.serialization.Model): +class ProcessServer(_serialization.Model): # pylint: disable=too-many-instance-attributes """Details of the Process Server. Variables are only populated by the server, and will be ignored when sending a request. - :param friendly_name: The Process Server's friendly name. - :type friendly_name: str - :param id: The Process Server Id. - :type id: str - :param ip_address: The IP address of the server. - :type ip_address: str - :param os_type: The OS type of the server. - :type os_type: str - :param agent_version: The version of the scout component on the server. - :type agent_version: str - :param last_heartbeat: The last heartbeat received from the server. - :type last_heartbeat: ~datetime.datetime - :param version_status: Version status. - :type version_status: str - :param mobility_service_updates: The list of the mobility service updates available on the + :ivar friendly_name: The Process Server's friendly name. + :vartype friendly_name: str + :ivar id: The Process Server Id. + :vartype id: str + :ivar ip_address: The IP address of the server. + :vartype ip_address: str + :ivar os_type: The OS type of the server. + :vartype os_type: str + :ivar agent_version: The version of the scout component on the server. + :vartype agent_version: str + :ivar last_heartbeat: The last heartbeat received from the server. + :vartype last_heartbeat: ~datetime.datetime + :ivar version_status: Version status. + :vartype version_status: str + :ivar mobility_service_updates: The list of the mobility service updates available on the Process Server. - :type mobility_service_updates: + :vartype mobility_service_updates: list[~azure.mgmt.recoveryservicessiterecovery.models.MobilityServiceUpdate] - :param host_id: The agent generated Id. - :type host_id: str - :param machine_count: The servers configured with this PS. - :type machine_count: str - :param replication_pair_count: The number of replication pairs configured in this PS. - :type replication_pair_count: str - :param system_load: The percentage of the system load. - :type system_load: str - :param system_load_status: The system load status. - :type system_load_status: str - :param cpu_load: The percentage of the CPU load. - :type cpu_load: str - :param cpu_load_status: The CPU load status. - :type cpu_load_status: str - :param total_memory_in_bytes: The total memory. - :type total_memory_in_bytes: long - :param available_memory_in_bytes: The available memory. - :type available_memory_in_bytes: long - :param memory_usage_status: The memory usage status. - :type memory_usage_status: str - :param total_space_in_bytes: The total space. - :type total_space_in_bytes: long - :param available_space_in_bytes: The available space. - :type available_space_in_bytes: long - :param space_usage_status: The space usage status. - :type space_usage_status: str - :param ps_service_status: The PS service status. - :type ps_service_status: str - :param ssl_cert_expiry_date: The PS SSL cert expiry date. - :type ssl_cert_expiry_date: ~datetime.datetime - :param ssl_cert_expiry_remaining_days: CS SSL cert expiry date. - :type ssl_cert_expiry_remaining_days: int - :param os_version: OS Version of the process server. Note: This will get populated if user has + :ivar host_id: The agent generated Id. + :vartype host_id: str + :ivar machine_count: The servers configured with this PS. + :vartype machine_count: str + :ivar replication_pair_count: The number of replication pairs configured in this PS. + :vartype replication_pair_count: str + :ivar system_load: The percentage of the system load. + :vartype system_load: str + :ivar system_load_status: The system load status. + :vartype system_load_status: str + :ivar cpu_load: The percentage of the CPU load. + :vartype cpu_load: str + :ivar cpu_load_status: The CPU load status. + :vartype cpu_load_status: str + :ivar total_memory_in_bytes: The total memory. + :vartype total_memory_in_bytes: int + :ivar available_memory_in_bytes: The available memory. + :vartype available_memory_in_bytes: int + :ivar memory_usage_status: The memory usage status. + :vartype memory_usage_status: str + :ivar total_space_in_bytes: The total space. + :vartype total_space_in_bytes: int + :ivar available_space_in_bytes: The available space. + :vartype available_space_in_bytes: int + :ivar space_usage_status: The space usage status. + :vartype space_usage_status: str + :ivar ps_service_status: The PS service status. + :vartype ps_service_status: str + :ivar ssl_cert_expiry_date: The PS SSL cert expiry date. + :vartype ssl_cert_expiry_date: ~datetime.datetime + :ivar ssl_cert_expiry_remaining_days: CS SSL cert expiry date. + :vartype ssl_cert_expiry_remaining_days: int + :ivar os_version: OS Version of the process server. Note: This will get populated if user has CS version greater than 9.12.0.0. - :type os_version: str - :param health_errors: Health errors. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param agent_version_details: The agent version details. - :type agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - :ivar health: The health of Process Server. Possible values include: "None", "Normal", - "Warning", "Critical". + :vartype os_version: str + :ivar health_errors: Health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar agent_version_details: The agent version details. + :vartype agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + :ivar health: The health of Process Server. Known values are: "None", "Normal", "Warning", and + "Critical". :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth :ivar ps_stats_refresh_time: The process server stats refresh time. :vartype ps_stats_refresh_time: ~datetime.datetime :ivar throughput_upload_pending_data_in_bytes: The uploading pending data in bytes. - :vartype throughput_upload_pending_data_in_bytes: long + :vartype throughput_upload_pending_data_in_bytes: int :ivar throughput_in_m_bps: The throughput in MBps. - :vartype throughput_in_m_bps: long + :vartype throughput_in_m_bps: int :ivar throughput_in_bytes: The throughput in bytes. - :vartype throughput_in_bytes: long + :vartype throughput_in_bytes: int :ivar throughput_status: The throughput status. :vartype throughput_status: str :ivar mars_communication_status: The MARS communication status. @@ -15315,66 +19319,66 @@ class ProcessServer(msrest.serialization.Model): """ _validation = { - 'health': {'readonly': True}, - 'ps_stats_refresh_time': {'readonly': True}, - 'throughput_upload_pending_data_in_bytes': {'readonly': True}, - 'throughput_in_m_bps': {'readonly': True}, - 'throughput_in_bytes': {'readonly': True}, - 'throughput_status': {'readonly': True}, - 'mars_communication_status': {'readonly': True}, - 'mars_registration_status': {'readonly': True}, - } - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'version_status': {'key': 'versionStatus', 'type': 'str'}, - 'mobility_service_updates': {'key': 'mobilityServiceUpdates', 'type': '[MobilityServiceUpdate]'}, - 'host_id': {'key': 'hostId', 'type': 'str'}, - 'machine_count': {'key': 'machineCount', 'type': 'str'}, - 'replication_pair_count': {'key': 'replicationPairCount', 'type': 'str'}, - 'system_load': {'key': 'systemLoad', 'type': 'str'}, - 'system_load_status': {'key': 'systemLoadStatus', 'type': 'str'}, - 'cpu_load': {'key': 'cpuLoad', 'type': 'str'}, - 'cpu_load_status': {'key': 'cpuLoadStatus', 'type': 'str'}, - 'total_memory_in_bytes': {'key': 'totalMemoryInBytes', 'type': 'long'}, - 'available_memory_in_bytes': {'key': 'availableMemoryInBytes', 'type': 'long'}, - 'memory_usage_status': {'key': 'memoryUsageStatus', 'type': 'str'}, - 'total_space_in_bytes': {'key': 'totalSpaceInBytes', 'type': 'long'}, - 'available_space_in_bytes': {'key': 'availableSpaceInBytes', 'type': 'long'}, - 'space_usage_status': {'key': 'spaceUsageStatus', 'type': 'str'}, - 'ps_service_status': {'key': 'psServiceStatus', 'type': 'str'}, - 'ssl_cert_expiry_date': {'key': 'sslCertExpiryDate', 'type': 'iso-8601'}, - 'ssl_cert_expiry_remaining_days': {'key': 'sslCertExpiryRemainingDays', 'type': 'int'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'agent_version_details': {'key': 'agentVersionDetails', 'type': 'VersionDetails'}, - 'health': {'key': 'health', 'type': 'str'}, - 'ps_stats_refresh_time': {'key': 'psStatsRefreshTime', 'type': 'iso-8601'}, - 'throughput_upload_pending_data_in_bytes': {'key': 'throughputUploadPendingDataInBytes', 'type': 'long'}, - 'throughput_in_m_bps': {'key': 'throughputInMBps', 'type': 'long'}, - 'throughput_in_bytes': {'key': 'throughputInBytes', 'type': 'long'}, - 'throughput_status': {'key': 'throughputStatus', 'type': 'str'}, - 'mars_communication_status': {'key': 'marsCommunicationStatus', 'type': 'str'}, - 'mars_registration_status': {'key': 'marsRegistrationStatus', 'type': 'str'}, - } - - def __init__( + "health": {"readonly": True}, + "ps_stats_refresh_time": {"readonly": True}, + "throughput_upload_pending_data_in_bytes": {"readonly": True}, + "throughput_in_m_bps": {"readonly": True}, + "throughput_in_bytes": {"readonly": True}, + "throughput_status": {"readonly": True}, + "mars_communication_status": {"readonly": True}, + "mars_registration_status": {"readonly": True}, + } + + _attribute_map = { + "friendly_name": {"key": "friendlyName", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "agent_version": {"key": "agentVersion", "type": "str"}, + "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, + "version_status": {"key": "versionStatus", "type": "str"}, + "mobility_service_updates": {"key": "mobilityServiceUpdates", "type": "[MobilityServiceUpdate]"}, + "host_id": {"key": "hostId", "type": "str"}, + "machine_count": {"key": "machineCount", "type": "str"}, + "replication_pair_count": {"key": "replicationPairCount", "type": "str"}, + "system_load": {"key": "systemLoad", "type": "str"}, + "system_load_status": {"key": "systemLoadStatus", "type": "str"}, + "cpu_load": {"key": "cpuLoad", "type": "str"}, + "cpu_load_status": {"key": "cpuLoadStatus", "type": "str"}, + "total_memory_in_bytes": {"key": "totalMemoryInBytes", "type": "int"}, + "available_memory_in_bytes": {"key": "availableMemoryInBytes", "type": "int"}, + "memory_usage_status": {"key": "memoryUsageStatus", "type": "str"}, + "total_space_in_bytes": {"key": "totalSpaceInBytes", "type": "int"}, + "available_space_in_bytes": {"key": "availableSpaceInBytes", "type": "int"}, + "space_usage_status": {"key": "spaceUsageStatus", "type": "str"}, + "ps_service_status": {"key": "psServiceStatus", "type": "str"}, + "ssl_cert_expiry_date": {"key": "sslCertExpiryDate", "type": "iso-8601"}, + "ssl_cert_expiry_remaining_days": {"key": "sslCertExpiryRemainingDays", "type": "int"}, + "os_version": {"key": "osVersion", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, + "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, + "agent_version_details": {"key": "agentVersionDetails", "type": "VersionDetails"}, + "health": {"key": "health", "type": "str"}, + "ps_stats_refresh_time": {"key": "psStatsRefreshTime", "type": "iso-8601"}, + "throughput_upload_pending_data_in_bytes": {"key": "throughputUploadPendingDataInBytes", "type": "int"}, + "throughput_in_m_bps": {"key": "throughputInMBps", "type": "int"}, + "throughput_in_bytes": {"key": "throughputInBytes", "type": "int"}, + "throughput_status": {"key": "throughputStatus", "type": "str"}, + "mars_communication_status": {"key": "marsCommunicationStatus", "type": "str"}, + "mars_registration_status": {"key": "marsRegistrationStatus", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, friendly_name: Optional[str] = None, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin ip_address: Optional[str] = None, os_type: Optional[str] = None, agent_version: Optional[str] = None, last_heartbeat: Optional[datetime.datetime] = None, version_status: Optional[str] = None, - mobility_service_updates: Optional[List["MobilityServiceUpdate"]] = None, + mobility_service_updates: Optional[List["_models.MobilityServiceUpdate"]] = None, host_id: Optional[str] = None, machine_count: Optional[str] = None, replication_pair_count: Optional[str] = None, @@ -15392,12 +19396,74 @@ def __init__( ssl_cert_expiry_date: Optional[datetime.datetime] = None, ssl_cert_expiry_remaining_days: Optional[int] = None, os_version: Optional[str] = None, - health_errors: Optional[List["HealthError"]] = None, + health_errors: Optional[List["_models.HealthError"]] = None, agent_expiry_date: Optional[datetime.datetime] = None, - agent_version_details: Optional["VersionDetails"] = None, - **kwargs - ): - super(ProcessServer, self).__init__(**kwargs) + agent_version_details: Optional["_models.VersionDetails"] = None, + **kwargs + ): + """ + :keyword friendly_name: The Process Server's friendly name. + :paramtype friendly_name: str + :keyword id: The Process Server Id. + :paramtype id: str + :keyword ip_address: The IP address of the server. + :paramtype ip_address: str + :keyword os_type: The OS type of the server. + :paramtype os_type: str + :keyword agent_version: The version of the scout component on the server. + :paramtype agent_version: str + :keyword last_heartbeat: The last heartbeat received from the server. + :paramtype last_heartbeat: ~datetime.datetime + :keyword version_status: Version status. + :paramtype version_status: str + :keyword mobility_service_updates: The list of the mobility service updates available on the + Process Server. + :paramtype mobility_service_updates: + list[~azure.mgmt.recoveryservicessiterecovery.models.MobilityServiceUpdate] + :keyword host_id: The agent generated Id. + :paramtype host_id: str + :keyword machine_count: The servers configured with this PS. + :paramtype machine_count: str + :keyword replication_pair_count: The number of replication pairs configured in this PS. + :paramtype replication_pair_count: str + :keyword system_load: The percentage of the system load. + :paramtype system_load: str + :keyword system_load_status: The system load status. + :paramtype system_load_status: str + :keyword cpu_load: The percentage of the CPU load. + :paramtype cpu_load: str + :keyword cpu_load_status: The CPU load status. + :paramtype cpu_load_status: str + :keyword total_memory_in_bytes: The total memory. + :paramtype total_memory_in_bytes: int + :keyword available_memory_in_bytes: The available memory. + :paramtype available_memory_in_bytes: int + :keyword memory_usage_status: The memory usage status. + :paramtype memory_usage_status: str + :keyword total_space_in_bytes: The total space. + :paramtype total_space_in_bytes: int + :keyword available_space_in_bytes: The available space. + :paramtype available_space_in_bytes: int + :keyword space_usage_status: The space usage status. + :paramtype space_usage_status: str + :keyword ps_service_status: The PS service status. + :paramtype ps_service_status: str + :keyword ssl_cert_expiry_date: The PS SSL cert expiry date. + :paramtype ssl_cert_expiry_date: ~datetime.datetime + :keyword ssl_cert_expiry_remaining_days: CS SSL cert expiry date. + :paramtype ssl_cert_expiry_remaining_days: int + :keyword os_version: OS Version of the process server. Note: This will get populated if user + has CS version greater than 9.12.0.0. + :paramtype os_version: str + :keyword health_errors: Health errors. + :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword agent_expiry_date: Agent expiry date. + :paramtype agent_expiry_date: ~datetime.datetime + :keyword agent_version_details: The agent version details. + :paramtype agent_version_details: + ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.id = id self.ip_address = ip_address @@ -15436,7 +19502,7 @@ def __init__( self.mars_registration_status = None -class ProcessServerDetails(msrest.serialization.Model): +class ProcessServerDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """Process server details. Variables are only populated by the server, and will be ignored when sending a request. @@ -15458,131 +19524,129 @@ class ProcessServerDetails(msrest.serialization.Model): :ivar last_heartbeat_utc: The last heartbeat received from the process server. :vartype last_heartbeat_utc: ~datetime.datetime :ivar total_memory_in_bytes: The total memory. - :vartype total_memory_in_bytes: long + :vartype total_memory_in_bytes: int :ivar available_memory_in_bytes: The available memory. - :vartype available_memory_in_bytes: long + :vartype available_memory_in_bytes: int :ivar used_memory_in_bytes: The used memory. - :vartype used_memory_in_bytes: long + :vartype used_memory_in_bytes: int :ivar memory_usage_percentage: The memory usage percentage. :vartype memory_usage_percentage: float :ivar total_space_in_bytes: The total disk space. - :vartype total_space_in_bytes: long + :vartype total_space_in_bytes: int :ivar available_space_in_bytes: The available disk space. - :vartype available_space_in_bytes: long + :vartype available_space_in_bytes: int :ivar used_space_in_bytes: The used disk space. - :vartype used_space_in_bytes: long + :vartype used_space_in_bytes: int :ivar free_space_percentage: The free disk space percentage. :vartype free_space_percentage: float :ivar throughput_upload_pending_data_in_bytes: The uploading pending data in bytes. - :vartype throughput_upload_pending_data_in_bytes: long + :vartype throughput_upload_pending_data_in_bytes: int :ivar throughput_in_bytes: The throughput in bytes. - :vartype throughput_in_bytes: long + :vartype throughput_in_bytes: int :ivar processor_usage_percentage: The processor usage percentage. :vartype processor_usage_percentage: float - :ivar throughput_status: The throughput status. Possible values include: "Healthy", "Warning", - "Critical", "Unknown". + :ivar throughput_status: The throughput status. Known values are: "Healthy", "Warning", + "Critical", and "Unknown". :vartype throughput_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus :ivar system_load: The system load. - :vartype system_load: long - :ivar system_load_status: The system load status. Possible values include: "Healthy", - "Warning", "Critical", "Unknown". + :vartype system_load: int + :ivar system_load_status: The system load status. Known values are: "Healthy", "Warning", + "Critical", and "Unknown". :vartype system_load_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar disk_usage_status: The disk usage status. Possible values include: "Healthy", "Warning", - "Critical", "Unknown". + :ivar disk_usage_status: The disk usage status. Known values are: "Healthy", "Warning", + "Critical", and "Unknown". :vartype disk_usage_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar memory_usage_status: The memory usage status. Possible values include: "Healthy", - "Warning", "Critical", "Unknown". + :ivar memory_usage_status: The memory usage status. Known values are: "Healthy", "Warning", + "Critical", and "Unknown". :vartype memory_usage_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar processor_usage_status: The processor usage status. Possible values include: "Healthy", - "Warning", "Critical", "Unknown". + :ivar processor_usage_status: The processor usage status. Known values are: "Healthy", + "Warning", "Critical", and "Unknown". :vartype processor_usage_status: str or ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar health: The health of the process server. Possible values include: "None", "Normal", - "Warning", "Critical". + :ivar health: The health of the process server. Known values are: "None", "Normal", "Warning", + and "Critical". :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth :ivar health_errors: The health errors. :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] :ivar protected_item_count: The protected item count. :vartype protected_item_count: int :ivar historic_health: The historic health of the process server based on the health in last 24 - hours. Possible values include: "None", "Normal", "Warning", "Critical". + hours. Known values are: "None", "Normal", "Warning", and "Critical". :vartype historic_health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'ip_addresses': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'total_memory_in_bytes': {'readonly': True}, - 'available_memory_in_bytes': {'readonly': True}, - 'used_memory_in_bytes': {'readonly': True}, - 'memory_usage_percentage': {'readonly': True}, - 'total_space_in_bytes': {'readonly': True}, - 'available_space_in_bytes': {'readonly': True}, - 'used_space_in_bytes': {'readonly': True}, - 'free_space_percentage': {'readonly': True}, - 'throughput_upload_pending_data_in_bytes': {'readonly': True}, - 'throughput_in_bytes': {'readonly': True}, - 'processor_usage_percentage': {'readonly': True}, - 'throughput_status': {'readonly': True}, - 'system_load': {'readonly': True}, - 'system_load_status': {'readonly': True}, - 'disk_usage_status': {'readonly': True}, - 'memory_usage_status': {'readonly': True}, - 'processor_usage_status': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - 'protected_item_count': {'readonly': True}, - 'historic_health': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'total_memory_in_bytes': {'key': 'totalMemoryInBytes', 'type': 'long'}, - 'available_memory_in_bytes': {'key': 'availableMemoryInBytes', 'type': 'long'}, - 'used_memory_in_bytes': {'key': 'usedMemoryInBytes', 'type': 'long'}, - 'memory_usage_percentage': {'key': 'memoryUsagePercentage', 'type': 'float'}, - 'total_space_in_bytes': {'key': 'totalSpaceInBytes', 'type': 'long'}, - 'available_space_in_bytes': {'key': 'availableSpaceInBytes', 'type': 'long'}, - 'used_space_in_bytes': {'key': 'usedSpaceInBytes', 'type': 'long'}, - 'free_space_percentage': {'key': 'freeSpacePercentage', 'type': 'float'}, - 'throughput_upload_pending_data_in_bytes': {'key': 'throughputUploadPendingDataInBytes', 'type': 'long'}, - 'throughput_in_bytes': {'key': 'throughputInBytes', 'type': 'long'}, - 'processor_usage_percentage': {'key': 'processorUsagePercentage', 'type': 'float'}, - 'throughput_status': {'key': 'throughputStatus', 'type': 'str'}, - 'system_load': {'key': 'systemLoad', 'type': 'long'}, - 'system_load_status': {'key': 'systemLoadStatus', 'type': 'str'}, - 'disk_usage_status': {'key': 'diskUsageStatus', 'type': 'str'}, - 'memory_usage_status': {'key': 'memoryUsageStatus', 'type': 'str'}, - 'processor_usage_status': {'key': 'processorUsageStatus', 'type': 'str'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'int'}, - 'historic_health': {'key': 'historicHealth', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProcessServerDetails, self).__init__(**kwargs) + "id": {"readonly": True}, + "name": {"readonly": True}, + "bios_id": {"readonly": True}, + "fabric_object_id": {"readonly": True}, + "fqdn": {"readonly": True}, + "ip_addresses": {"readonly": True}, + "version": {"readonly": True}, + "last_heartbeat_utc": {"readonly": True}, + "total_memory_in_bytes": {"readonly": True}, + "available_memory_in_bytes": {"readonly": True}, + "used_memory_in_bytes": {"readonly": True}, + "memory_usage_percentage": {"readonly": True}, + "total_space_in_bytes": {"readonly": True}, + "available_space_in_bytes": {"readonly": True}, + "used_space_in_bytes": {"readonly": True}, + "free_space_percentage": {"readonly": True}, + "throughput_upload_pending_data_in_bytes": {"readonly": True}, + "throughput_in_bytes": {"readonly": True}, + "processor_usage_percentage": {"readonly": True}, + "throughput_status": {"readonly": True}, + "system_load": {"readonly": True}, + "system_load_status": {"readonly": True}, + "disk_usage_status": {"readonly": True}, + "memory_usage_status": {"readonly": True}, + "processor_usage_status": {"readonly": True}, + "health": {"readonly": True}, + "health_errors": {"readonly": True}, + "protected_item_count": {"readonly": True}, + "historic_health": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + "version": {"key": "version", "type": "str"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "total_memory_in_bytes": {"key": "totalMemoryInBytes", "type": "int"}, + "available_memory_in_bytes": {"key": "availableMemoryInBytes", "type": "int"}, + "used_memory_in_bytes": {"key": "usedMemoryInBytes", "type": "int"}, + "memory_usage_percentage": {"key": "memoryUsagePercentage", "type": "float"}, + "total_space_in_bytes": {"key": "totalSpaceInBytes", "type": "int"}, + "available_space_in_bytes": {"key": "availableSpaceInBytes", "type": "int"}, + "used_space_in_bytes": {"key": "usedSpaceInBytes", "type": "int"}, + "free_space_percentage": {"key": "freeSpacePercentage", "type": "float"}, + "throughput_upload_pending_data_in_bytes": {"key": "throughputUploadPendingDataInBytes", "type": "int"}, + "throughput_in_bytes": {"key": "throughputInBytes", "type": "int"}, + "processor_usage_percentage": {"key": "processorUsagePercentage", "type": "float"}, + "throughput_status": {"key": "throughputStatus", "type": "str"}, + "system_load": {"key": "systemLoad", "type": "int"}, + "system_load_status": {"key": "systemLoadStatus", "type": "str"}, + "disk_usage_status": {"key": "diskUsageStatus", "type": "str"}, + "memory_usage_status": {"key": "memoryUsageStatus", "type": "str"}, + "processor_usage_status": {"key": "processorUsageStatus", "type": "str"}, + "health": {"key": "health", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, + "protected_item_count": {"key": "protectedItemCount", "type": "int"}, + "historic_health": {"key": "historicHealth", "type": "str"}, + } + + def __init__(self, **kwargs): # pylint: disable=too-many-locals + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.bios_id = None @@ -15625,91 +19689,100 @@ class ProtectableItem(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The custom data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectableItemProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ProtectableItemProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["ProtectableItemProperties"] = None, + properties: Optional["_models.ProtectableItemProperties"] = None, **kwargs ): - super(ProtectableItem, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The custom data. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class ProtectableItemCollection(msrest.serialization.Model): +class ProtectableItemCollection(_serialization.Model): """Protectable item collection. - :param value: The Protectable item details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The Protectable item details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ProtectableItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ProtectableItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["ProtectableItem"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.ProtectableItem"]] = None, next_link: Optional[str] = None, **kwargs ): - super(ProtectableItemCollection, self).__init__(**kwargs) + """ + :keyword value: The Protectable item details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class ProtectableItemProperties(msrest.serialization.Model): +class ProtectableItemProperties(_serialization.Model): """Replication protected item custom data details. - :param friendly_name: The name. - :type friendly_name: str - :param protection_status: The protection status. - :type protection_status: str - :param replication_protected_item_id: The ARM resource of protected items. - :type replication_protected_item_id: str - :param recovery_services_provider_id: The recovery provider ARM Id. - :type recovery_services_provider_id: str - :param protection_readiness_errors: The Current protection readiness errors. - :type protection_readiness_errors: list[str] - :param supported_replication_providers: The list of replication providers supported for the + :ivar friendly_name: The name. + :vartype friendly_name: str + :ivar protection_status: The protection status. + :vartype protection_status: str + :ivar replication_protected_item_id: The ARM resource of protected items. + :vartype replication_protected_item_id: str + :ivar recovery_services_provider_id: The recovery provider ARM Id. + :vartype recovery_services_provider_id: str + :ivar protection_readiness_errors: The Current protection readiness errors. + :vartype protection_readiness_errors: list[str] + :ivar supported_replication_providers: The list of replication providers supported for the protectable item. - :type supported_replication_providers: list[str] - :param custom_details: The Replication provider custom settings. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigurationSettings + :vartype supported_replication_providers: list[str] + :ivar custom_details: The Replication provider custom settings. + :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigurationSettings """ _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'replication_protected_item_id': {'key': 'replicationProtectedItemId', 'type': 'str'}, - 'recovery_services_provider_id': {'key': 'recoveryServicesProviderId', 'type': 'str'}, - 'protection_readiness_errors': {'key': 'protectionReadinessErrors', 'type': '[str]'}, - 'supported_replication_providers': {'key': 'supportedReplicationProviders', 'type': '[str]'}, - 'custom_details': {'key': 'customDetails', 'type': 'ConfigurationSettings'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "replication_protected_item_id": {"key": "replicationProtectedItemId", "type": "str"}, + "recovery_services_provider_id": {"key": "recoveryServicesProviderId", "type": "str"}, + "protection_readiness_errors": {"key": "protectionReadinessErrors", "type": "[str]"}, + "supported_replication_providers": {"key": "supportedReplicationProviders", "type": "[str]"}, + "custom_details": {"key": "customDetails", "type": "ConfigurationSettings"}, } def __init__( @@ -15721,10 +19794,28 @@ def __init__( recovery_services_provider_id: Optional[str] = None, protection_readiness_errors: Optional[List[str]] = None, supported_replication_providers: Optional[List[str]] = None, - custom_details: Optional["ConfigurationSettings"] = None, - **kwargs - ): - super(ProtectableItemProperties, self).__init__(**kwargs) + custom_details: Optional["_models.ConfigurationSettings"] = None, + **kwargs + ): + """ + :keyword friendly_name: The name. + :paramtype friendly_name: str + :keyword protection_status: The protection status. + :paramtype protection_status: str + :keyword replication_protected_item_id: The ARM resource of protected items. + :paramtype replication_protected_item_id: str + :keyword recovery_services_provider_id: The recovery provider ARM Id. + :paramtype recovery_services_provider_id: str + :keyword protection_readiness_errors: The Current protection readiness errors. + :paramtype protection_readiness_errors: list[str] + :keyword supported_replication_providers: The list of replication providers supported for the + protectable item. + :paramtype supported_replication_providers: list[str] + :keyword custom_details: The Replication provider custom settings. + :paramtype custom_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ConfigurationSettings + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.protection_status = protection_status self.replication_protected_item_id = replication_protected_item_id @@ -15734,59 +19825,58 @@ def __init__( self.custom_details = custom_details -class ProtectableItemQueryParameter(msrest.serialization.Model): +class ProtectableItemQueryParameter(_serialization.Model): """Query parameter to enumerate Protectable items. - :param state: State of the Protectable item query filter. - :type state: str + :ivar state: State of the Protectable item query filter. + :vartype state: str """ _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, + "state": {"key": "state", "type": "str"}, } - def __init__( - self, - *, - state: Optional[str] = None, - **kwargs - ): - super(ProtectableItemQueryParameter, self).__init__(**kwargs) + def __init__(self, *, state: Optional[str] = None, **kwargs): + """ + :keyword state: State of the Protectable item query filter. + :paramtype state: str + """ + super().__init__(**kwargs) self.state = state -class ProtectedItemsQueryParameter(msrest.serialization.Model): +class ProtectedItemsQueryParameter(_serialization.Model): """Query parameter to enumerate protected items. - :param source_fabric_name: The source fabric name filter. - :type source_fabric_name: str - :param recovery_plan_name: The recovery plan filter. - :type recovery_plan_name: str - :param source_fabric_location: The source fabric location filter. - :type source_fabric_location: str - :param fabric_object_id: The fabric object Id filter. - :type fabric_object_id: str - :param v_center_name: The vCenter name filter. - :type v_center_name: str - :param instance_type: The replication provider type. - :type instance_type: str - :param multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Possible values include: "AutoCreated", "UserSpecified". - :type multi_vm_group_create_option: str or + :ivar source_fabric_name: The source fabric name filter. + :vartype source_fabric_name: str + :ivar recovery_plan_name: The recovery plan filter. + :vartype recovery_plan_name: str + :ivar source_fabric_location: The source fabric location filter. + :vartype source_fabric_location: str + :ivar fabric_object_id: The fabric object Id filter. + :vartype fabric_object_id: str + :ivar v_center_name: The vCenter name filter. + :vartype v_center_name: str + :ivar instance_type: The replication provider type. + :vartype instance_type: str + :ivar multi_vm_group_create_option: Whether Multi VM group is auto created or specified by + user. Known values are: "AutoCreated" and "UserSpecified". + :vartype multi_vm_group_create_option: str or ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :param process_server_id: The process server Id filter. - :type process_server_id: str + :ivar process_server_id: The process server Id filter. + :vartype process_server_id: str """ _attribute_map = { - 'source_fabric_name': {'key': 'sourceFabricName', 'type': 'str'}, - 'recovery_plan_name': {'key': 'recoveryPlanName', 'type': 'str'}, - 'source_fabric_location': {'key': 'sourceFabricLocation', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'v_center_name': {'key': 'vCenterName', 'type': 'str'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'multi_vm_group_create_option': {'key': 'multiVmGroupCreateOption', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, + "source_fabric_name": {"key": "sourceFabricName", "type": "str"}, + "recovery_plan_name": {"key": "recoveryPlanName", "type": "str"}, + "source_fabric_location": {"key": "sourceFabricLocation", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "v_center_name": {"key": "vCenterName", "type": "str"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "multi_vm_group_create_option": {"key": "multiVmGroupCreateOption", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, } def __init__( @@ -15798,11 +19888,31 @@ def __init__( fabric_object_id: Optional[str] = None, v_center_name: Optional[str] = None, instance_type: Optional[str] = None, - multi_vm_group_create_option: Optional[Union[str, "MultiVmGroupCreateOption"]] = None, + multi_vm_group_create_option: Optional[Union[str, "_models.MultiVmGroupCreateOption"]] = None, process_server_id: Optional[str] = None, **kwargs ): - super(ProtectedItemsQueryParameter, self).__init__(**kwargs) + """ + :keyword source_fabric_name: The source fabric name filter. + :paramtype source_fabric_name: str + :keyword recovery_plan_name: The recovery plan filter. + :paramtype recovery_plan_name: str + :keyword source_fabric_location: The source fabric location filter. + :paramtype source_fabric_location: str + :keyword fabric_object_id: The fabric object Id filter. + :paramtype fabric_object_id: str + :keyword v_center_name: The vCenter name filter. + :paramtype v_center_name: str + :keyword instance_type: The replication provider type. + :paramtype instance_type: str + :keyword multi_vm_group_create_option: Whether Multi VM group is auto created or specified by + user. Known values are: "AutoCreated" and "UserSpecified". + :paramtype multi_vm_group_create_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption + :keyword process_server_id: The process server Id filter. + :paramtype process_server_id: str + """ + super().__init__(**kwargs) self.source_fabric_name = source_fabric_name self.recovery_plan_name = recovery_plan_name self.source_fabric_location = source_fabric_location @@ -15824,64 +19934,74 @@ class ProtectionContainer(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The custom data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectionContainerProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ProtectionContainerProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["ProtectionContainerProperties"] = None, + properties: Optional["_models.ProtectionContainerProperties"] = None, **kwargs ): - super(ProtectionContainer, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The custom data. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class ProtectionContainerCollection(msrest.serialization.Model): +class ProtectionContainerCollection(_serialization.Model): """Protection Container collection. - :param value: The Protection Container details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The Protection Container details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ProtectionContainer]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ProtectionContainer]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["ProtectionContainer"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.ProtectionContainer"]] = None, next_link: Optional[str] = None, **kwargs ): - super(ProtectionContainerCollection, self).__init__(**kwargs) + """ + :keyword value: The Protection Container details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class ProtectionContainerFabricSpecificDetails(msrest.serialization.Model): +class ProtectionContainerFabricSpecificDetails(_serialization.Model): """Base class for fabric specific details of container. Variables are only populated by the server, and will be ignored when sending a request. @@ -15891,18 +20011,16 @@ class ProtectionContainerFabricSpecificDetails(msrest.serialization.Model): """ _validation = { - 'instance_type': {'readonly': True}, + "instance_type": {"readonly": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(ProtectionContainerFabricSpecificDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None @@ -15917,104 +20035,123 @@ class ProtectionContainerMapping(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The custom data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectionContainerMappingProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ProtectionContainerMappingProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["ProtectionContainerMappingProperties"] = None, + properties: Optional["_models.ProtectionContainerMappingProperties"] = None, **kwargs ): - super(ProtectionContainerMapping, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The custom data. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class ProtectionContainerMappingCollection(msrest.serialization.Model): +class ProtectionContainerMappingCollection(_serialization.Model): """Protection container mapping collection class. - :param value: List of container mappings. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :param next_link: Link to fetch rest of the data. - :type next_link: str + :ivar value: List of container mappings. + :vartype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :ivar next_link: Link to fetch rest of the data. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ProtectionContainerMapping]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ProtectionContainerMapping]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["ProtectionContainerMapping"]] = None, + value: Optional[List["_models.ProtectionContainerMapping"]] = None, next_link: Optional[str] = None, **kwargs ): - super(ProtectionContainerMappingCollection, self).__init__(**kwargs) + """ + :keyword value: List of container mappings. + :paramtype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :keyword next_link: Link to fetch rest of the data. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class ProtectionContainerMappingProperties(msrest.serialization.Model): +class ProtectionContainerMappingProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Protection container mapping properties. - :param target_protection_container_id: Paired protection container ARM ID. - :type target_protection_container_id: str - :param target_protection_container_friendly_name: Friendly name of paired container. - :type target_protection_container_friendly_name: str - :param provider_specific_details: Provider specific provider details. - :type provider_specific_details: + :ivar target_protection_container_id: Paired protection container ARM ID. + :vartype target_protection_container_id: str + :ivar target_protection_container_friendly_name: Friendly name of paired container. + :vartype target_protection_container_friendly_name: str + :ivar provider_specific_details: Provider specific provider details. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProviderSpecificDetails - :param health: Health of pairing. - :type health: str - :param health_error_details: Health error. - :type health_error_details: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param policy_id: Policy ARM Id. - :type policy_id: str - :param state: Association Status. - :type state: str - :param source_protection_container_friendly_name: Friendly name of source protection container. - :type source_protection_container_friendly_name: str - :param source_fabric_friendly_name: Friendly name of source fabric. - :type source_fabric_friendly_name: str - :param target_fabric_friendly_name: Friendly name of target fabric. - :type target_fabric_friendly_name: str - :param policy_friendly_name: Friendly name of replication policy. - :type policy_friendly_name: str - """ - - _attribute_map = { - 'target_protection_container_id': {'key': 'targetProtectionContainerId', 'type': 'str'}, - 'target_protection_container_friendly_name': {'key': 'targetProtectionContainerFriendlyName', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ProtectionContainerMappingProviderSpecificDetails'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_error_details': {'key': 'healthErrorDetails', 'type': '[HealthError]'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'source_protection_container_friendly_name': {'key': 'sourceProtectionContainerFriendlyName', 'type': 'str'}, - 'source_fabric_friendly_name': {'key': 'sourceFabricFriendlyName', 'type': 'str'}, - 'target_fabric_friendly_name': {'key': 'targetFabricFriendlyName', 'type': 'str'}, - 'policy_friendly_name': {'key': 'policyFriendlyName', 'type': 'str'}, + :ivar health: Health of pairing. + :vartype health: str + :ivar health_error_details: Health error. + :vartype health_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar policy_id: Policy ARM Id. + :vartype policy_id: str + :ivar state: Association Status. + :vartype state: str + :ivar source_protection_container_friendly_name: Friendly name of source protection container. + :vartype source_protection_container_friendly_name: str + :ivar source_fabric_friendly_name: Friendly name of source fabric. + :vartype source_fabric_friendly_name: str + :ivar target_fabric_friendly_name: Friendly name of target fabric. + :vartype target_fabric_friendly_name: str + :ivar policy_friendly_name: Friendly name of replication policy. + :vartype policy_friendly_name: str + """ + + _attribute_map = { + "target_protection_container_id": {"key": "targetProtectionContainerId", "type": "str"}, + "target_protection_container_friendly_name": {"key": "targetProtectionContainerFriendlyName", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "ProtectionContainerMappingProviderSpecificDetails", + }, + "health": {"key": "health", "type": "str"}, + "health_error_details": {"key": "healthErrorDetails", "type": "[HealthError]"}, + "policy_id": {"key": "policyId", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "source_protection_container_friendly_name": {"key": "sourceProtectionContainerFriendlyName", "type": "str"}, + "source_fabric_friendly_name": {"key": "sourceFabricFriendlyName", "type": "str"}, + "target_fabric_friendly_name": {"key": "targetFabricFriendlyName", "type": "str"}, + "policy_friendly_name": {"key": "policyFriendlyName", "type": "str"}, } def __init__( @@ -16022,9 +20159,9 @@ def __init__( *, target_protection_container_id: Optional[str] = None, target_protection_container_friendly_name: Optional[str] = None, - provider_specific_details: Optional["ProtectionContainerMappingProviderSpecificDetails"] = None, + provider_specific_details: Optional["_models.ProtectionContainerMappingProviderSpecificDetails"] = None, health: Optional[str] = None, - health_error_details: Optional[List["HealthError"]] = None, + health_error_details: Optional[List["_models.HealthError"]] = None, policy_id: Optional[str] = None, state: Optional[str] = None, source_protection_container_friendly_name: Optional[str] = None, @@ -16033,7 +20170,34 @@ def __init__( policy_friendly_name: Optional[str] = None, **kwargs ): - super(ProtectionContainerMappingProperties, self).__init__(**kwargs) + """ + :keyword target_protection_container_id: Paired protection container ARM ID. + :paramtype target_protection_container_id: str + :keyword target_protection_container_friendly_name: Friendly name of paired container. + :paramtype target_protection_container_friendly_name: str + :keyword provider_specific_details: Provider specific provider details. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProviderSpecificDetails + :keyword health: Health of pairing. + :paramtype health: str + :keyword health_error_details: Health error. + :paramtype health_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword policy_id: Policy ARM Id. + :paramtype policy_id: str + :keyword state: Association Status. + :paramtype state: str + :keyword source_protection_container_friendly_name: Friendly name of source protection + container. + :paramtype source_protection_container_friendly_name: str + :keyword source_fabric_friendly_name: Friendly name of source fabric. + :paramtype source_fabric_friendly_name: str + :keyword target_fabric_friendly_name: Friendly name of target fabric. + :paramtype target_fabric_friendly_name: str + :keyword policy_friendly_name: Friendly name of replication policy. + :paramtype policy_friendly_name: str + """ + super().__init__(**kwargs) self.target_protection_container_id = target_protection_container_id self.target_protection_container_friendly_name = target_protection_container_friendly_name self.provider_specific_details = provider_specific_details @@ -16047,34 +20211,34 @@ def __init__( self.policy_friendly_name = policy_friendly_name -class ProtectionContainerProperties(msrest.serialization.Model): +class ProtectionContainerProperties(_serialization.Model): """Protection profile custom data details. - :param fabric_friendly_name: Fabric friendly name. - :type fabric_friendly_name: str - :param friendly_name: The name. - :type friendly_name: str - :param fabric_type: The fabric type. - :type fabric_type: str - :param protected_item_count: Number of protected PEs. - :type protected_item_count: int - :param pairing_status: The pairing status of this cloud. - :type pairing_status: str - :param role: The role of this cloud. - :type role: str - :param fabric_specific_details: Fabric specific details. - :type fabric_specific_details: + :ivar fabric_friendly_name: Fabric friendly name. + :vartype fabric_friendly_name: str + :ivar friendly_name: The name. + :vartype friendly_name: str + :ivar fabric_type: The fabric type. + :vartype fabric_type: str + :ivar protected_item_count: Number of protected PEs. + :vartype protected_item_count: int + :ivar pairing_status: The pairing status of this cloud. + :vartype pairing_status: str + :ivar role: The role of this cloud. + :vartype role: str + :ivar fabric_specific_details: Fabric specific details. + :vartype fabric_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails """ _attribute_map = { - 'fabric_friendly_name': {'key': 'fabricFriendlyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'fabric_type': {'key': 'fabricType', 'type': 'str'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'int'}, - 'pairing_status': {'key': 'pairingStatus', 'type': 'str'}, - 'role': {'key': 'role', 'type': 'str'}, - 'fabric_specific_details': {'key': 'fabricSpecificDetails', 'type': 'ProtectionContainerFabricSpecificDetails'}, + "fabric_friendly_name": {"key": "fabricFriendlyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "fabric_type": {"key": "fabricType", "type": "str"}, + "protected_item_count": {"key": "protectedItemCount", "type": "int"}, + "pairing_status": {"key": "pairingStatus", "type": "str"}, + "role": {"key": "role", "type": "str"}, + "fabric_specific_details": {"key": "fabricSpecificDetails", "type": "ProtectionContainerFabricSpecificDetails"}, } def __init__( @@ -16086,10 +20250,27 @@ def __init__( protected_item_count: Optional[int] = None, pairing_status: Optional[str] = None, role: Optional[str] = None, - fabric_specific_details: Optional["ProtectionContainerFabricSpecificDetails"] = None, - **kwargs - ): - super(ProtectionContainerProperties, self).__init__(**kwargs) + fabric_specific_details: Optional["_models.ProtectionContainerFabricSpecificDetails"] = None, + **kwargs + ): + """ + :keyword fabric_friendly_name: Fabric friendly name. + :paramtype fabric_friendly_name: str + :keyword friendly_name: The name. + :paramtype friendly_name: str + :keyword fabric_type: The fabric type. + :paramtype fabric_type: str + :keyword protected_item_count: Number of protected PEs. + :paramtype protected_item_count: int + :keyword pairing_status: The pairing status of this cloud. + :paramtype pairing_status: str + :keyword role: The role of this cloud. + :paramtype role: str + :keyword fabric_specific_details: Fabric specific details. + :paramtype fabric_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails + """ + super().__init__(**kwargs) self.fabric_friendly_name = fabric_friendly_name self.friendly_name = friendly_name self.fabric_type = fabric_type @@ -16099,27 +20280,27 @@ def __init__( self.fabric_specific_details = fabric_specific_details -class ProviderError(msrest.serialization.Model): +class ProviderError(_serialization.Model): """This class contains the error details per object. - :param error_code: The Error code. - :type error_code: int - :param error_message: The Error message. - :type error_message: str - :param error_id: The Provider error Id. - :type error_id: str - :param possible_causes: The possible causes for the error. - :type possible_causes: str - :param recommended_action: The recommended action to resolve the error. - :type recommended_action: str + :ivar error_code: The Error code. + :vartype error_code: int + :ivar error_message: The Error message. + :vartype error_message: str + :ivar error_id: The Provider error Id. + :vartype error_id: str + :ivar possible_causes: The possible causes for the error. + :vartype possible_causes: str + :ivar recommended_action: The recommended action to resolve the error. + :vartype recommended_action: str """ _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'error_id': {'key': 'errorId', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, + "error_code": {"key": "errorCode", "type": "int"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "error_id": {"key": "errorId", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, } def __init__( @@ -16132,7 +20313,19 @@ def __init__( recommended_action: Optional[str] = None, **kwargs ): - super(ProviderError, self).__init__(**kwargs) + """ + :keyword error_code: The Error code. + :paramtype error_code: int + :keyword error_message: The Error message. + :paramtype error_message: str + :keyword error_id: The Provider error Id. + :paramtype error_id: str + :keyword possible_causes: The possible causes for the error. + :paramtype possible_causes: str + :keyword recommended_action: The recommended action to resolve the error. + :paramtype recommended_action: str + """ + super().__init__(**kwargs) self.error_code = error_code self.error_message = error_message self.error_id = error_id @@ -16140,7 +20333,7 @@ def __init__( self.recommended_action = recommended_action -class PushInstallerDetails(msrest.serialization.Model): +class PushInstallerDetails(_serialization.Model): """Push installer details. Variables are only populated by the server, and will be ignored when sending a request. @@ -16159,42 +20352,40 @@ class PushInstallerDetails(msrest.serialization.Model): :vartype version: str :ivar last_heartbeat_utc: The last heartbeat received from the push installer. :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the push installer. Possible values include: "None", "Normal", - "Warning", "Critical". + :ivar health: The health of the push installer. Known values are: "None", "Normal", "Warning", + and "Critical". :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth :ivar health_errors: The health errors. :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "bios_id": {"readonly": True}, + "fabric_object_id": {"readonly": True}, + "fqdn": {"readonly": True}, + "version": {"readonly": True}, + "last_heartbeat_utc": {"readonly": True}, + "health": {"readonly": True}, + "health_errors": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "health": {"key": "health", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, } - def __init__( - self, - **kwargs - ): - super(PushInstallerDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.bios_id = None @@ -16206,7 +20397,7 @@ def __init__( self.health_errors = None -class RcmProxyDetails(msrest.serialization.Model): +class RcmProxyDetails(_serialization.Model): """RCM proxy details. Variables are only populated by the server, and will be ignored when sending a request. @@ -16227,44 +20418,42 @@ class RcmProxyDetails(msrest.serialization.Model): :vartype version: str :ivar last_heartbeat_utc: The last heartbeat received from the RCM proxy. :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the RCM proxy. Possible values include: "None", "Normal", - "Warning", "Critical". + :ivar health: The health of the RCM proxy. Known values are: "None", "Normal", "Warning", and + "Critical". :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth :ivar health_errors: The health errors. :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'client_authentication_type': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "bios_id": {"readonly": True}, + "fabric_object_id": {"readonly": True}, + "fqdn": {"readonly": True}, + "client_authentication_type": {"readonly": True}, + "version": {"readonly": True}, + "last_heartbeat_utc": {"readonly": True}, + "health": {"readonly": True}, + "health_errors": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'client_authentication_type': {'key': 'clientAuthenticationType', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "client_authentication_type": {"key": "clientAuthenticationType", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "health": {"key": "health", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, } - def __init__( - self, - **kwargs - ): - super(RcmProxyDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.bios_id = None @@ -16288,66 +20477,64 @@ class RecoveryPlan(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom details. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The custom details. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RecoveryPlanProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "RecoveryPlanProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["RecoveryPlanProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.RecoveryPlanProperties"] = None, **kwargs ): - super(RecoveryPlan, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The custom details. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class RecoveryPlanProviderSpecificDetails(msrest.serialization.Model): +class RecoveryPlanProviderSpecificDetails(_serialization.Model): """Recovery plan provider specific details. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanA2ADetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanA2ADetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'A2A': 'RecoveryPlanA2ADetails'} - } + _subtype_map = {"instance_type": {"A2A": "RecoveryPlanA2ADetails"}} - def __init__( - self, - **kwargs - ): - super(RecoveryPlanProviderSpecificDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -16356,66 +20543,75 @@ class RecoveryPlanA2ADetails(RecoveryPlanProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param primary_zone: The primary zone. - :type primary_zone: str - :param recovery_zone: The recovery zone. - :type recovery_zone: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar primary_zone: The primary zone. + :vartype primary_zone: str + :ivar recovery_zone: The recovery zone. + :vartype recovery_zone: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_zone': {'key': 'primaryZone', 'type': 'str'}, - 'recovery_zone': {'key': 'recoveryZone', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_zone": {"key": "primaryZone", "type": "str"}, + "recovery_zone": {"key": "recoveryZone", "type": "str"}, } - def __init__( - self, - *, - primary_zone: Optional[str] = None, - recovery_zone: Optional[str] = None, - **kwargs - ): - super(RecoveryPlanA2ADetails, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + def __init__(self, *, primary_zone: Optional[str] = None, recovery_zone: Optional[str] = None, **kwargs): + """ + :keyword primary_zone: The primary zone. + :paramtype primary_zone: str + :keyword recovery_zone: The recovery zone. + :paramtype recovery_zone: str + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.primary_zone = primary_zone self.recovery_zone = recovery_zone -class RecoveryPlanProviderSpecificFailoverInput(msrest.serialization.Model): +class RecoveryPlanProviderSpecificFailoverInput(_serialization.Model): """Recovery plan provider specific failover input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanA2AFailoverInput, RecoveryPlanHyperVReplicaAzureFailoverInput, RecoveryPlanHyperVReplicaAzureFailbackInput, RecoveryPlanInMageFailoverInput, RecoveryPlanInMageAzureV2FailoverInput, RecoveryPlanInMageRcmFailoverInput, RecoveryPlanInMageRcmFailbackFailoverInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanA2AFailoverInput, RecoveryPlanHyperVReplicaAzureFailoverInput, + RecoveryPlanHyperVReplicaAzureFailbackInput, RecoveryPlanInMageFailoverInput, + RecoveryPlanInMageAzureV2FailoverInput, RecoveryPlanInMageRcmFailoverInput, + RecoveryPlanInMageRcmFailbackFailoverInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'A2A': 'RecoveryPlanA2AFailoverInput', 'HyperVReplicaAzure': 'RecoveryPlanHyperVReplicaAzureFailoverInput', 'HyperVReplicaAzureFailback': 'RecoveryPlanHyperVReplicaAzureFailbackInput', 'InMage': 'RecoveryPlanInMageFailoverInput', 'InMageAzureV2': 'RecoveryPlanInMageAzureV2FailoverInput', 'InMageRcm': 'RecoveryPlanInMageRcmFailoverInput', 'InMageRcmFailback': 'RecoveryPlanInMageRcmFailbackFailoverInput'} - } - - def __init__( - self, - **kwargs - ): - super(RecoveryPlanProviderSpecificFailoverInput, self).__init__(**kwargs) + "instance_type": { + "A2A": "RecoveryPlanA2AFailoverInput", + "HyperVReplicaAzure": "RecoveryPlanHyperVReplicaAzureFailoverInput", + "HyperVReplicaAzureFailback": "RecoveryPlanHyperVReplicaAzureFailbackInput", + "InMage": "RecoveryPlanInMageFailoverInput", + "InMageAzureV2": "RecoveryPlanInMageAzureV2FailoverInput", + "InMageRcm": "RecoveryPlanInMageRcmFailoverInput", + "InMageRcmFailback": "RecoveryPlanInMageRcmFailbackFailoverInput", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -16424,78 +20620,88 @@ class RecoveryPlanA2AFailoverInput(RecoveryPlanProviderSpecificFailoverInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "Latest", "LatestApplicationConsistent", "LatestCrashConsistent", "LatestProcessed". - :type recovery_point_type: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_type: The recovery point type. Required. Known values are: "Latest", + "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". + :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.A2ARpRecoveryPointType - :param cloud_service_creation_option: A value indicating whether to use recovery cloud service + :ivar cloud_service_creation_option: A value indicating whether to use recovery cloud service for TFO or not. - :type cloud_service_creation_option: str - :param multi_vm_sync_point_option: A value indicating whether multi VM sync enabled VMs should - use multi VM sync points for failover. Possible values include: "UseMultiVmSyncRecoveryPoint", + :vartype cloud_service_creation_option: str + :ivar multi_vm_sync_point_option: A value indicating whether multi VM sync enabled VMs should + use multi VM sync points for failover. Known values are: "UseMultiVmSyncRecoveryPoint" and "UsePerVmRecoveryPoint". - :type multi_vm_sync_point_option: str or + :vartype multi_vm_sync_point_option: str or ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmSyncPointOption """ _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, + "instance_type": {"required": True}, + "recovery_point_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'cloud_service_creation_option': {'key': 'cloudServiceCreationOption', 'type': 'str'}, - 'multi_vm_sync_point_option': {'key': 'multiVmSyncPointOption', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "cloud_service_creation_option": {"key": "cloudServiceCreationOption", "type": "str"}, + "multi_vm_sync_point_option": {"key": "multiVmSyncPointOption", "type": "str"}, } def __init__( self, *, - recovery_point_type: Union[str, "A2ARpRecoveryPointType"], + recovery_point_type: Union[str, "_models.A2ARpRecoveryPointType"], cloud_service_creation_option: Optional[str] = None, - multi_vm_sync_point_option: Optional[Union[str, "MultiVmSyncPointOption"]] = None, - **kwargs - ): - super(RecoveryPlanA2AFailoverInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + multi_vm_sync_point_option: Optional[Union[str, "_models.MultiVmSyncPointOption"]] = None, + **kwargs + ): + """ + :keyword recovery_point_type: The recovery point type. Required. Known values are: "Latest", + "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". + :paramtype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.A2ARpRecoveryPointType + :keyword cloud_service_creation_option: A value indicating whether to use recovery cloud + service for TFO or not. + :paramtype cloud_service_creation_option: str + :keyword multi_vm_sync_point_option: A value indicating whether multi VM sync enabled VMs + should use multi VM sync points for failover. Known values are: "UseMultiVmSyncRecoveryPoint" + and "UsePerVmRecoveryPoint". + :paramtype multi_vm_sync_point_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmSyncPointOption + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.recovery_point_type = recovery_point_type self.cloud_service_creation_option = cloud_service_creation_option self.multi_vm_sync_point_option = multi_vm_sync_point_option -class RecoveryPlanProviderSpecificInput(msrest.serialization.Model): +class RecoveryPlanProviderSpecificInput(_serialization.Model): """Recovery plan provider specific input base class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanA2AInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanA2AInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'A2A': 'RecoveryPlanA2AInput'} - } + _subtype_map = {"instance_type": {"A2A": "RecoveryPlanA2AInput"}} - def __init__( - self, - **kwargs - ): - super(RecoveryPlanProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -16504,22 +20710,30 @@ class RecoveryPlanA2AInput(RecoveryPlanProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str - :param primary_zone: The primary zone. - :type primary_zone: str - :param recovery_zone: The recovery zone. - :type recovery_zone: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str + :ivar primary_zone: The primary zone. + :vartype primary_zone: str + :ivar recovery_zone: The recovery zone. + :vartype recovery_zone: str + :ivar primary_extended_location: The primary extended location. + :vartype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_extended_location: The recovery extended location. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_zone': {'key': 'primaryZone', 'type': 'str'}, - 'recovery_zone': {'key': 'recoveryZone', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_zone": {"key": "primaryZone", "type": "str"}, + "recovery_zone": {"key": "recoveryZone", "type": "str"}, + "primary_extended_location": {"key": "primaryExtendedLocation", "type": "ExtendedLocation"}, + "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, } def __init__( @@ -16527,91 +20741,124 @@ def __init__( *, primary_zone: Optional[str] = None, recovery_zone: Optional[str] = None, - **kwargs - ): - super(RecoveryPlanA2AInput, self).__init__(**kwargs) - self.instance_type = 'A2A' # type: str + primary_extended_location: Optional["_models.ExtendedLocation"] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = None, + **kwargs + ): + """ + :keyword primary_zone: The primary zone. + :paramtype primary_zone: str + :keyword recovery_zone: The recovery zone. + :paramtype recovery_zone: str + :keyword primary_extended_location: The primary extended location. + :paramtype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :keyword recovery_extended_location: The recovery extended location. + :paramtype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + """ + super().__init__(**kwargs) + self.instance_type = "A2A" # type: str self.primary_zone = primary_zone self.recovery_zone = recovery_zone + self.primary_extended_location = primary_extended_location + self.recovery_extended_location = recovery_extended_location -class RecoveryPlanAction(msrest.serialization.Model): +class RecoveryPlanAction(_serialization.Model): """Recovery plan action details. All required parameters must be populated in order to send to Azure. - :param action_name: Required. The action name. - :type action_name: str - :param failover_types: Required. The list of failover types. - :type failover_types: list[str or + :ivar action_name: The action name. Required. + :vartype action_name: str + :ivar failover_types: The list of failover types. Required. + :vartype failover_types: list[str or ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation] - :param failover_directions: Required. The list of failover directions. - :type failover_directions: list[str or + :ivar failover_directions: The list of failover directions. Required. + :vartype failover_directions: list[str or ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections] - :param custom_details: Required. The custom details. - :type custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionDetails + :ivar custom_details: The custom details. Required. + :vartype custom_details: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionDetails """ _validation = { - 'action_name': {'required': True}, - 'failover_types': {'required': True}, - 'failover_directions': {'required': True}, - 'custom_details': {'required': True}, + "action_name": {"required": True}, + "failover_types": {"required": True}, + "failover_directions": {"required": True}, + "custom_details": {"required": True}, } _attribute_map = { - 'action_name': {'key': 'actionName', 'type': 'str'}, - 'failover_types': {'key': 'failoverTypes', 'type': '[str]'}, - 'failover_directions': {'key': 'failoverDirections', 'type': '[str]'}, - 'custom_details': {'key': 'customDetails', 'type': 'RecoveryPlanActionDetails'}, + "action_name": {"key": "actionName", "type": "str"}, + "failover_types": {"key": "failoverTypes", "type": "[str]"}, + "failover_directions": {"key": "failoverDirections", "type": "[str]"}, + "custom_details": {"key": "customDetails", "type": "RecoveryPlanActionDetails"}, } def __init__( self, *, action_name: str, - failover_types: List[Union[str, "ReplicationProtectedItemOperation"]], - failover_directions: List[Union[str, "PossibleOperationsDirections"]], - custom_details: "RecoveryPlanActionDetails", - **kwargs - ): - super(RecoveryPlanAction, self).__init__(**kwargs) + failover_types: List[Union[str, "_models.ReplicationProtectedItemOperation"]], + failover_directions: List[Union[str, "_models.PossibleOperationsDirections"]], + custom_details: "_models.RecoveryPlanActionDetails", + **kwargs + ): + """ + :keyword action_name: The action name. Required. + :paramtype action_name: str + :keyword failover_types: The list of failover types. Required. + :paramtype failover_types: list[str or + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation] + :keyword failover_directions: The list of failover directions. Required. + :paramtype failover_directions: list[str or + ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections] + :keyword custom_details: The custom details. Required. + :paramtype custom_details: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionDetails + """ + super().__init__(**kwargs) self.action_name = action_name self.failover_types = failover_types self.failover_directions = failover_directions self.custom_details = custom_details -class RecoveryPlanActionDetails(msrest.serialization.Model): +class RecoveryPlanActionDetails(_serialization.Model): """Recovery plan action custom details. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanAutomationRunbookActionDetails, RecoveryPlanManualActionDetails, RecoveryPlanScriptActionDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanAutomationRunbookActionDetails, RecoveryPlanManualActionDetails, + RecoveryPlanScriptActionDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of action details (see - RecoveryPlanActionDetailsTypes enum for possible values).Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum + for possible values). Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } _subtype_map = { - 'instance_type': {'AutomationRunbookActionDetails': 'RecoveryPlanAutomationRunbookActionDetails', 'ManualActionDetails': 'RecoveryPlanManualActionDetails', 'ScriptActionDetails': 'RecoveryPlanScriptActionDetails'} + "instance_type": { + "AutomationRunbookActionDetails": "RecoveryPlanAutomationRunbookActionDetails", + "ManualActionDetails": "RecoveryPlanManualActionDetails", + "ScriptActionDetails": "RecoveryPlanScriptActionDetails", + } } - def __init__( - self, - **kwargs - ): - super(RecoveryPlanActionDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] @@ -16620,112 +20867,140 @@ class RecoveryPlanAutomationRunbookActionDetails(RecoveryPlanActionDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of action details (see - RecoveryPlanActionDetailsTypes enum for possible values).Constant filled by server. - :type instance_type: str - :param runbook_id: The runbook ARM Id. - :type runbook_id: str - :param timeout: The runbook timeout. - :type timeout: str - :param fabric_location: Required. The fabric location. Possible values include: "Primary", + :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum + for possible values). Required. + :vartype instance_type: str + :ivar runbook_id: The runbook ARM Id. + :vartype runbook_id: str + :ivar timeout: The runbook timeout. + :vartype timeout: str + :ivar fabric_location: The fabric location. Required. Known values are: "Primary" and "Recovery". - :type fabric_location: str or + :vartype fabric_location: str or ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation """ _validation = { - 'instance_type': {'required': True}, - 'fabric_location': {'required': True}, + "instance_type": {"required": True}, + "fabric_location": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'runbook_id': {'key': 'runbookId', 'type': 'str'}, - 'timeout': {'key': 'timeout', 'type': 'str'}, - 'fabric_location': {'key': 'fabricLocation', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "runbook_id": {"key": "runbookId", "type": "str"}, + "timeout": {"key": "timeout", "type": "str"}, + "fabric_location": {"key": "fabricLocation", "type": "str"}, } def __init__( self, *, - fabric_location: Union[str, "RecoveryPlanActionLocation"], + fabric_location: Union[str, "_models.RecoveryPlanActionLocation"], runbook_id: Optional[str] = None, timeout: Optional[str] = None, **kwargs ): - super(RecoveryPlanAutomationRunbookActionDetails, self).__init__(**kwargs) - self.instance_type = 'AutomationRunbookActionDetails' # type: str + """ + :keyword runbook_id: The runbook ARM Id. + :paramtype runbook_id: str + :keyword timeout: The runbook timeout. + :paramtype timeout: str + :keyword fabric_location: The fabric location. Required. Known values are: "Primary" and + "Recovery". + :paramtype fabric_location: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation + """ + super().__init__(**kwargs) + self.instance_type = "AutomationRunbookActionDetails" # type: str self.runbook_id = runbook_id self.timeout = timeout self.fabric_location = fabric_location -class RecoveryPlanCollection(msrest.serialization.Model): +class RecoveryPlanCollection(_serialization.Model): """Recovery plan collection details. - :param value: The list of recovery plans. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The list of recovery plans. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[RecoveryPlan]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[RecoveryPlan]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["RecoveryPlan"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.RecoveryPlan"]] = None, next_link: Optional[str] = None, **kwargs ): - super(RecoveryPlanCollection, self).__init__(**kwargs) + """ + :keyword value: The list of recovery plans. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RecoveryPlanGroup(msrest.serialization.Model): +class RecoveryPlanGroup(_serialization.Model): """Recovery plan group details. All required parameters must be populated in order to send to Azure. - :param group_type: Required. The group type. Possible values include: "Shutdown", "Boot", + :ivar group_type: The group type. Required. Known values are: "Shutdown", "Boot", and "Failover". - :type group_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroupType - :param replication_protected_items: The list of protected items. - :type replication_protected_items: + :vartype group_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroupType + :ivar replication_protected_items: The list of protected items. + :vartype replication_protected_items: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem] - :param start_group_actions: The start group actions. - :type start_group_actions: + :ivar start_group_actions: The start group actions. + :vartype start_group_actions: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] - :param end_group_actions: The end group actions. - :type end_group_actions: + :ivar end_group_actions: The end group actions. + :vartype end_group_actions: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] """ _validation = { - 'group_type': {'required': True}, + "group_type": {"required": True}, } _attribute_map = { - 'group_type': {'key': 'groupType', 'type': 'str'}, - 'replication_protected_items': {'key': 'replicationProtectedItems', 'type': '[RecoveryPlanProtectedItem]'}, - 'start_group_actions': {'key': 'startGroupActions', 'type': '[RecoveryPlanAction]'}, - 'end_group_actions': {'key': 'endGroupActions', 'type': '[RecoveryPlanAction]'}, + "group_type": {"key": "groupType", "type": "str"}, + "replication_protected_items": {"key": "replicationProtectedItems", "type": "[RecoveryPlanProtectedItem]"}, + "start_group_actions": {"key": "startGroupActions", "type": "[RecoveryPlanAction]"}, + "end_group_actions": {"key": "endGroupActions", "type": "[RecoveryPlanAction]"}, } def __init__( self, *, - group_type: Union[str, "RecoveryPlanGroupType"], - replication_protected_items: Optional[List["RecoveryPlanProtectedItem"]] = None, - start_group_actions: Optional[List["RecoveryPlanAction"]] = None, - end_group_actions: Optional[List["RecoveryPlanAction"]] = None, + group_type: Union[str, "_models.RecoveryPlanGroupType"], + replication_protected_items: Optional[List["_models.RecoveryPlanProtectedItem"]] = None, + start_group_actions: Optional[List["_models.RecoveryPlanAction"]] = None, + end_group_actions: Optional[List["_models.RecoveryPlanAction"]] = None, **kwargs ): - super(RecoveryPlanGroup, self).__init__(**kwargs) + """ + :keyword group_type: The group type. Required. Known values are: "Shutdown", "Boot", and + "Failover". + :paramtype group_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroupType + :keyword replication_protected_items: The list of protected items. + :paramtype replication_protected_items: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem] + :keyword start_group_actions: The start group actions. + :paramtype start_group_actions: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] + :keyword end_group_actions: The end group actions. + :paramtype end_group_actions: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] + """ + super().__init__(**kwargs) self.group_type = group_type self.replication_protected_items = replication_protected_items self.start_group_actions = start_group_actions @@ -16735,50 +21010,58 @@ def __init__( class RecoveryPlanGroupTaskDetails(GroupTaskDetails): """This class represents the recovery plan group task. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RecoveryPlanShutdownGroupTaskDetails. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanShutdownGroupTaskDetails All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param child_tasks: The child tasks. - :type child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :param name: The name. - :type name: str - :param group_id: The group identifier. - :type group_id: str - :param rp_group_type: The group type. - :type rp_group_type: str + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar child_tasks: The child tasks. + :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :ivar name: The name. + :vartype name: str + :ivar group_id: The group identifier. + :vartype group_id: str + :ivar rp_group_type: The group type. + :vartype rp_group_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'child_tasks': {'key': 'childTasks', 'type': '[ASRTask]'}, - 'name': {'key': 'name', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'rp_group_type': {'key': 'rpGroupType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "child_tasks": {"key": "childTasks", "type": "[ASRTask]"}, + "name": {"key": "name", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "rp_group_type": {"key": "rpGroupType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'RecoveryPlanShutdownGroupTaskDetails': 'RecoveryPlanShutdownGroupTaskDetails'} - } + _subtype_map = {"instance_type": {"RecoveryPlanShutdownGroupTaskDetails": "RecoveryPlanShutdownGroupTaskDetails"}} def __init__( self, *, - child_tasks: Optional[List["ASRTask"]] = None, + child_tasks: Optional[List["_models.ASRTask"]] = None, name: Optional[str] = None, group_id: Optional[str] = None, rp_group_type: Optional[str] = None, **kwargs ): - super(RecoveryPlanGroupTaskDetails, self).__init__(child_tasks=child_tasks, **kwargs) - self.instance_type = 'RecoveryPlanGroupTaskDetails' # type: str + """ + :keyword child_tasks: The child tasks. + :paramtype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :keyword name: The name. + :paramtype name: str + :keyword group_id: The group identifier. + :paramtype group_id: str + :keyword rp_group_type: The group type. + :paramtype rp_group_type: str + """ + super().__init__(child_tasks=child_tasks, **kwargs) + self.instance_type = "RecoveryPlanGroupTaskDetails" # type: str self.name = name self.group_id = group_id self.rp_group_type = rp_group_type @@ -16789,38 +21072,49 @@ class RecoveryPlanHyperVReplicaAzureFailbackInput(RecoveryPlanProviderSpecificFa All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param data_sync_option: Required. The data sync option. Possible values include: - "ForDownTime", "ForSynchronization". - :type data_sync_option: str or ~azure.mgmt.recoveryservicessiterecovery.models.DataSyncStatus - :param recovery_vm_creation_option: Required. The ALR option. Possible values include: - "CreateVmIfNotFound", "NoAction". - :type recovery_vm_creation_option: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar data_sync_option: The data sync option. Required. Known values are: "ForDownTime" and + "ForSynchronization". + :vartype data_sync_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.DataSyncStatus + :ivar recovery_vm_creation_option: The ALR option. Required. Known values are: + "CreateVmIfNotFound" and "NoAction". + :vartype recovery_vm_creation_option: str or ~azure.mgmt.recoveryservicessiterecovery.models.AlternateLocationRecoveryOption """ _validation = { - 'instance_type': {'required': True}, - 'data_sync_option': {'required': True}, - 'recovery_vm_creation_option': {'required': True}, + "instance_type": {"required": True}, + "data_sync_option": {"required": True}, + "recovery_vm_creation_option": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'data_sync_option': {'key': 'dataSyncOption', 'type': 'str'}, - 'recovery_vm_creation_option': {'key': 'recoveryVmCreationOption', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "data_sync_option": {"key": "dataSyncOption", "type": "str"}, + "recovery_vm_creation_option": {"key": "recoveryVmCreationOption", "type": "str"}, } def __init__( self, *, - data_sync_option: Union[str, "DataSyncStatus"], - recovery_vm_creation_option: Union[str, "AlternateLocationRecoveryOption"], + data_sync_option: Union[str, "_models.DataSyncStatus"], + recovery_vm_creation_option: Union[str, "_models.AlternateLocationRecoveryOption"], **kwargs ): - super(RecoveryPlanHyperVReplicaAzureFailbackInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzureFailback' # type: str + """ + :keyword data_sync_option: The data sync option. Required. Known values are: "ForDownTime" and + "ForSynchronization". + :paramtype data_sync_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.DataSyncStatus + :keyword recovery_vm_creation_option: The ALR option. Required. Known values are: + "CreateVmIfNotFound" and "NoAction". + :paramtype recovery_vm_creation_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AlternateLocationRecoveryOption + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzureFailback" # type: str self.data_sync_option = data_sync_option self.recovery_vm_creation_option = recovery_vm_creation_option @@ -16830,27 +21124,27 @@ class RecoveryPlanHyperVReplicaAzureFailoverInput(RecoveryPlanProviderSpecificFa All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param primary_kek_certificate_pfx: The primary KEK certificate PFX. - :type primary_kek_certificate_pfx: str - :param secondary_kek_certificate_pfx: The secondary KEK certificate PFX. - :type secondary_kek_certificate_pfx: str - :param recovery_point_type: The recovery point type. Possible values include: "Latest", - "LatestApplicationConsistent", "LatestProcessed". - :type recovery_point_type: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar primary_kek_certificate_pfx: The primary KEK certificate PFX. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: The secondary KEK certificate PFX. + :vartype secondary_kek_certificate_pfx: str + :ivar recovery_point_type: The recovery point type. Known values are: "Latest", + "LatestApplicationConsistent", and "LatestProcessed". + :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureRpRecoveryPointType """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'primary_kek_certificate_pfx': {'key': 'primaryKekCertificatePfx', 'type': 'str'}, - 'secondary_kek_certificate_pfx': {'key': 'secondaryKekCertificatePfx', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, + "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, } def __init__( @@ -16858,11 +21152,21 @@ def __init__( *, primary_kek_certificate_pfx: Optional[str] = None, secondary_kek_certificate_pfx: Optional[str] = None, - recovery_point_type: Optional[Union[str, "HyperVReplicaAzureRpRecoveryPointType"]] = None, - **kwargs - ): - super(RecoveryPlanHyperVReplicaAzureFailoverInput, self).__init__(**kwargs) - self.instance_type = 'HyperVReplicaAzure' # type: str + recovery_point_type: Optional[Union[str, "_models.HyperVReplicaAzureRpRecoveryPointType"]] = None, + **kwargs + ): + """ + :keyword primary_kek_certificate_pfx: The primary KEK certificate PFX. + :paramtype primary_kek_certificate_pfx: str + :keyword secondary_kek_certificate_pfx: The secondary KEK certificate PFX. + :paramtype secondary_kek_certificate_pfx: str + :keyword recovery_point_type: The recovery point type. Known values are: "Latest", + "LatestApplicationConsistent", and "LatestProcessed". + :paramtype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureRpRecoveryPointType + """ + super().__init__(**kwargs) + self.instance_type = "HyperVReplicaAzure" # type: str self.primary_kek_certificate_pfx = primary_kek_certificate_pfx self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx self.recovery_point_type = recovery_point_type @@ -16873,37 +21177,46 @@ class RecoveryPlanInMageAzureV2FailoverInput(RecoveryPlanProviderSpecificFailove All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "Latest", "LatestApplicationConsistent", "LatestCrashConsistent", "LatestProcessed". - :type recovery_point_type: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_type: The recovery point type. Required. Known values are: "Latest", + "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". + :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.InMageV2RpRecoveryPointType - :param use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use + :ivar use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. - :type use_multi_vm_sync_point: str + :vartype use_multi_vm_sync_point: str """ _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, + "instance_type": {"required": True}, + "recovery_point_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'use_multi_vm_sync_point': {'key': 'useMultiVmSyncPoint', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "use_multi_vm_sync_point": {"key": "useMultiVmSyncPoint", "type": "str"}, } def __init__( self, *, - recovery_point_type: Union[str, "InMageV2RpRecoveryPointType"], + recovery_point_type: Union[str, "_models.InMageV2RpRecoveryPointType"], use_multi_vm_sync_point: Optional[str] = None, **kwargs ): - super(RecoveryPlanInMageAzureV2FailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageAzureV2' # type: str + """ + :keyword recovery_point_type: The recovery point type. Required. Known values are: "Latest", + "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". + :paramtype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.InMageV2RpRecoveryPointType + :keyword use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should + use multi VM sync points for failover. + :paramtype use_multi_vm_sync_point: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageAzureV2" # type: str self.recovery_point_type = recovery_point_type self.use_multi_vm_sync_point = use_multi_vm_sync_point @@ -16913,32 +21226,33 @@ class RecoveryPlanInMageFailoverInput(RecoveryPlanProviderSpecificFailoverInput) All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "LatestTime", "LatestTag", "Custom". - :type recovery_point_type: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_type: The recovery point type. Required. Known values are: "LatestTime", + "LatestTag", and "Custom". + :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.RpInMageRecoveryPointType """ _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, + "instance_type": {"required": True}, + "recovery_point_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, } - def __init__( - self, - *, - recovery_point_type: Union[str, "RpInMageRecoveryPointType"], - **kwargs - ): - super(RecoveryPlanInMageFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMage' # type: str + def __init__(self, *, recovery_point_type: Union[str, "_models.RpInMageRecoveryPointType"], **kwargs): + """ + :keyword recovery_point_type: The recovery point type. Required. Known values are: + "LatestTime", "LatestTag", and "Custom". + :paramtype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RpInMageRecoveryPointType + """ + super().__init__(**kwargs) + self.instance_type = "InMage" # type: str self.recovery_point_type = recovery_point_type @@ -16947,37 +21261,46 @@ class RecoveryPlanInMageRcmFailbackFailoverInput(RecoveryPlanProviderSpecificFai All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "ApplicationConsistent", "CrashConsistent". - :type recovery_point_type: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_type: The recovery point type. Required. Known values are: + "ApplicationConsistent" and "CrashConsistent". + :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType - :param use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use + :ivar use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. - :type use_multi_vm_sync_point: str + :vartype use_multi_vm_sync_point: str """ _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, + "instance_type": {"required": True}, + "recovery_point_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'use_multi_vm_sync_point': {'key': 'useMultiVmSyncPoint', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "use_multi_vm_sync_point": {"key": "useMultiVmSyncPoint", "type": "str"}, } def __init__( self, *, - recovery_point_type: Union[str, "InMageRcmFailbackRecoveryPointType"], + recovery_point_type: Union[str, "_models.InMageRcmFailbackRecoveryPointType"], use_multi_vm_sync_point: Optional[str] = None, **kwargs ): - super(RecoveryPlanInMageRcmFailbackFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcmFailback' # type: str + """ + :keyword recovery_point_type: The recovery point type. Required. Known values are: + "ApplicationConsistent" and "CrashConsistent". + :paramtype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType + :keyword use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should + use multi VM sync points for failover. + :paramtype use_multi_vm_sync_point: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcmFailback" # type: str self.recovery_point_type = recovery_point_type self.use_multi_vm_sync_point = use_multi_vm_sync_point @@ -16987,37 +21310,46 @@ class RecoveryPlanInMageRcmFailoverInput(RecoveryPlanProviderSpecificFailoverInp All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_type: Required. The recovery point type. Possible values include: - "Latest", "LatestApplicationConsistent", "LatestCrashConsistent", "LatestProcessed". - :type recovery_point_type: str or + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_type: The recovery point type. Required. Known values are: "Latest", + "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". + :vartype recovery_point_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPointType - :param use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use + :ivar use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. - :type use_multi_vm_sync_point: str + :vartype use_multi_vm_sync_point: str """ _validation = { - 'instance_type': {'required': True}, - 'recovery_point_type': {'required': True}, + "instance_type": {"required": True}, + "recovery_point_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'use_multi_vm_sync_point': {'key': 'useMultiVmSyncPoint', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "use_multi_vm_sync_point": {"key": "useMultiVmSyncPoint", "type": "str"}, } def __init__( self, *, - recovery_point_type: Union[str, "RecoveryPlanPointType"], + recovery_point_type: Union[str, "_models.RecoveryPlanPointType"], use_multi_vm_sync_point: Optional[str] = None, **kwargs ): - super(RecoveryPlanInMageRcmFailoverInput, self).__init__(**kwargs) - self.instance_type = 'InMageRcm' # type: str + """ + :keyword recovery_point_type: The recovery point type. Required. Known values are: "Latest", + "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". + :paramtype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPointType + :keyword use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should + use multi VM sync points for failover. + :paramtype use_multi_vm_sync_point: str + """ + super().__init__(**kwargs) + self.instance_type = "InMageRcm" # type: str self.recovery_point_type = recovery_point_type self.use_multi_vm_sync_point = use_multi_vm_sync_point @@ -17027,151 +21359,166 @@ class RecoveryPlanManualActionDetails(RecoveryPlanActionDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of action details (see - RecoveryPlanActionDetailsTypes enum for possible values).Constant filled by server. - :type instance_type: str - :param description: The manual action description. - :type description: str + :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum + for possible values). Required. + :vartype instance_type: str + :ivar description: The manual action description. + :vartype description: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - *, - description: Optional[str] = None, - **kwargs - ): - super(RecoveryPlanManualActionDetails, self).__init__(**kwargs) - self.instance_type = 'ManualActionDetails' # type: str + def __init__(self, *, description: Optional[str] = None, **kwargs): + """ + :keyword description: The manual action description. + :paramtype description: str + """ + super().__init__(**kwargs) + self.instance_type = "ManualActionDetails" # type: str self.description = description -class RecoveryPlanPlannedFailoverInput(msrest.serialization.Model): +class RecoveryPlanPlannedFailoverInput(_serialization.Model): """Recovery plan planned failover input. All required parameters must be populated in order to send to Azure. - :param properties: Required. The recovery plan planned failover input properties. - :type properties: + :ivar properties: The recovery plan planned failover input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RecoveryPlanPlannedFailoverInputProperties'}, + "properties": {"key": "properties", "type": "RecoveryPlanPlannedFailoverInputProperties"}, } - def __init__( - self, - *, - properties: "RecoveryPlanPlannedFailoverInputProperties", - **kwargs - ): - super(RecoveryPlanPlannedFailoverInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.RecoveryPlanPlannedFailoverInputProperties", **kwargs): + """ + :keyword properties: The recovery plan planned failover input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class RecoveryPlanPlannedFailoverInputProperties(msrest.serialization.Model): +class RecoveryPlanPlannedFailoverInputProperties(_serialization.Model): """Recovery plan planned failover input properties. All required parameters must be populated in order to send to Azure. - :param failover_direction: Required. The failover direction. Possible values include: - "PrimaryToRecovery", "RecoveryToPrimary". - :type failover_direction: str or + :ivar failover_direction: The failover direction. Required. Known values are: + "PrimaryToRecovery" and "RecoveryToPrimary". + :vartype failover_direction: str or ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :param provider_specific_details: The provider specific properties. - :type provider_specific_details: + :ivar provider_specific_details: The provider specific properties. + :vartype provider_specific_details: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] """ _validation = { - 'failover_direction': {'required': True}, + "failover_direction": {"required": True}, } _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': '[RecoveryPlanProviderSpecificFailoverInput]'}, + "failover_direction": {"key": "failoverDirection", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "[RecoveryPlanProviderSpecificFailoverInput]", + }, } def __init__( self, *, - failover_direction: Union[str, "PossibleOperationsDirections"], - provider_specific_details: Optional[List["RecoveryPlanProviderSpecificFailoverInput"]] = None, + failover_direction: Union[str, "_models.PossibleOperationsDirections"], + provider_specific_details: Optional[List["_models.RecoveryPlanProviderSpecificFailoverInput"]] = None, **kwargs ): - super(RecoveryPlanPlannedFailoverInputProperties, self).__init__(**kwargs) + """ + :keyword failover_direction: The failover direction. Required. Known values are: + "PrimaryToRecovery" and "RecoveryToPrimary". + :paramtype failover_direction: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections + :keyword provider_specific_details: The provider specific properties. + :paramtype provider_specific_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] + """ + super().__init__(**kwargs) self.failover_direction = failover_direction self.provider_specific_details = provider_specific_details -class RecoveryPlanProperties(msrest.serialization.Model): +class RecoveryPlanProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Recovery plan properties. - :param friendly_name: The friendly name. - :type friendly_name: str - :param primary_fabric_id: The primary fabric Id. - :type primary_fabric_id: str - :param primary_fabric_friendly_name: The primary fabric friendly name. - :type primary_fabric_friendly_name: str - :param recovery_fabric_id: The recovery fabric Id. - :type recovery_fabric_id: str - :param recovery_fabric_friendly_name: The recovery fabric friendly name. - :type recovery_fabric_friendly_name: str - :param failover_deployment_model: The failover deployment model. - :type failover_deployment_model: str - :param replication_providers: The list of replication providers. - :type replication_providers: list[str] - :param allowed_operations: The list of allowed operations. - :type allowed_operations: list[str] - :param last_planned_failover_time: The start time of the last planned failover. - :type last_planned_failover_time: ~datetime.datetime - :param last_unplanned_failover_time: The start time of the last unplanned failover. - :type last_unplanned_failover_time: ~datetime.datetime - :param last_test_failover_time: The start time of the last test failover. - :type last_test_failover_time: ~datetime.datetime - :param current_scenario: The current scenario details. - :type current_scenario: ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :param current_scenario_status: The recovery plan status. - :type current_scenario_status: str - :param current_scenario_status_description: The recovery plan status description. - :type current_scenario_status_description: str - :param groups: The recovery plan groups. - :type groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - :param provider_specific_details: The provider id and provider specific details. - :type provider_specific_details: + :ivar friendly_name: The friendly name. + :vartype friendly_name: str + :ivar primary_fabric_id: The primary fabric Id. + :vartype primary_fabric_id: str + :ivar primary_fabric_friendly_name: The primary fabric friendly name. + :vartype primary_fabric_friendly_name: str + :ivar recovery_fabric_id: The recovery fabric Id. + :vartype recovery_fabric_id: str + :ivar recovery_fabric_friendly_name: The recovery fabric friendly name. + :vartype recovery_fabric_friendly_name: str + :ivar failover_deployment_model: The failover deployment model. + :vartype failover_deployment_model: str + :ivar replication_providers: The list of replication providers. + :vartype replication_providers: list[str] + :ivar allowed_operations: The list of allowed operations. + :vartype allowed_operations: list[str] + :ivar last_planned_failover_time: The start time of the last planned failover. + :vartype last_planned_failover_time: ~datetime.datetime + :ivar last_unplanned_failover_time: The start time of the last unplanned failover. + :vartype last_unplanned_failover_time: ~datetime.datetime + :ivar last_test_failover_time: The start time of the last test failover. + :vartype last_test_failover_time: ~datetime.datetime + :ivar current_scenario: The current scenario details. + :vartype current_scenario: + ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails + :ivar current_scenario_status: The recovery plan status. + :vartype current_scenario_status: str + :ivar current_scenario_status_description: The recovery plan status description. + :vartype current_scenario_status_description: str + :ivar groups: The recovery plan groups. + :vartype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] + :ivar provider_specific_details: The provider id and provider specific details. + :vartype provider_specific_details: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails] """ _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'primary_fabric_id': {'key': 'primaryFabricId', 'type': 'str'}, - 'primary_fabric_friendly_name': {'key': 'primaryFabricFriendlyName', 'type': 'str'}, - 'recovery_fabric_id': {'key': 'recoveryFabricId', 'type': 'str'}, - 'recovery_fabric_friendly_name': {'key': 'recoveryFabricFriendlyName', 'type': 'str'}, - 'failover_deployment_model': {'key': 'failoverDeploymentModel', 'type': 'str'}, - 'replication_providers': {'key': 'replicationProviders', 'type': '[str]'}, - 'allowed_operations': {'key': 'allowedOperations', 'type': '[str]'}, - 'last_planned_failover_time': {'key': 'lastPlannedFailoverTime', 'type': 'iso-8601'}, - 'last_unplanned_failover_time': {'key': 'lastUnplannedFailoverTime', 'type': 'iso-8601'}, - 'last_test_failover_time': {'key': 'lastTestFailoverTime', 'type': 'iso-8601'}, - 'current_scenario': {'key': 'currentScenario', 'type': 'CurrentScenarioDetails'}, - 'current_scenario_status': {'key': 'currentScenarioStatus', 'type': 'str'}, - 'current_scenario_status_description': {'key': 'currentScenarioStatusDescription', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[RecoveryPlanGroup]'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': '[RecoveryPlanProviderSpecificDetails]'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "primary_fabric_id": {"key": "primaryFabricId", "type": "str"}, + "primary_fabric_friendly_name": {"key": "primaryFabricFriendlyName", "type": "str"}, + "recovery_fabric_id": {"key": "recoveryFabricId", "type": "str"}, + "recovery_fabric_friendly_name": {"key": "recoveryFabricFriendlyName", "type": "str"}, + "failover_deployment_model": {"key": "failoverDeploymentModel", "type": "str"}, + "replication_providers": {"key": "replicationProviders", "type": "[str]"}, + "allowed_operations": {"key": "allowedOperations", "type": "[str]"}, + "last_planned_failover_time": {"key": "lastPlannedFailoverTime", "type": "iso-8601"}, + "last_unplanned_failover_time": {"key": "lastUnplannedFailoverTime", "type": "iso-8601"}, + "last_test_failover_time": {"key": "lastTestFailoverTime", "type": "iso-8601"}, + "current_scenario": {"key": "currentScenario", "type": "CurrentScenarioDetails"}, + "current_scenario_status": {"key": "currentScenarioStatus", "type": "str"}, + "current_scenario_status_description": {"key": "currentScenarioStatusDescription", "type": "str"}, + "groups": {"key": "groups", "type": "[RecoveryPlanGroup]"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "[RecoveryPlanProviderSpecificDetails]", + }, } def __init__( @@ -17188,14 +21535,50 @@ def __init__( last_planned_failover_time: Optional[datetime.datetime] = None, last_unplanned_failover_time: Optional[datetime.datetime] = None, last_test_failover_time: Optional[datetime.datetime] = None, - current_scenario: Optional["CurrentScenarioDetails"] = None, + current_scenario: Optional["_models.CurrentScenarioDetails"] = None, current_scenario_status: Optional[str] = None, current_scenario_status_description: Optional[str] = None, - groups: Optional[List["RecoveryPlanGroup"]] = None, - provider_specific_details: Optional[List["RecoveryPlanProviderSpecificDetails"]] = None, - **kwargs - ): - super(RecoveryPlanProperties, self).__init__(**kwargs) + groups: Optional[List["_models.RecoveryPlanGroup"]] = None, + provider_specific_details: Optional[List["_models.RecoveryPlanProviderSpecificDetails"]] = None, + **kwargs + ): + """ + :keyword friendly_name: The friendly name. + :paramtype friendly_name: str + :keyword primary_fabric_id: The primary fabric Id. + :paramtype primary_fabric_id: str + :keyword primary_fabric_friendly_name: The primary fabric friendly name. + :paramtype primary_fabric_friendly_name: str + :keyword recovery_fabric_id: The recovery fabric Id. + :paramtype recovery_fabric_id: str + :keyword recovery_fabric_friendly_name: The recovery fabric friendly name. + :paramtype recovery_fabric_friendly_name: str + :keyword failover_deployment_model: The failover deployment model. + :paramtype failover_deployment_model: str + :keyword replication_providers: The list of replication providers. + :paramtype replication_providers: list[str] + :keyword allowed_operations: The list of allowed operations. + :paramtype allowed_operations: list[str] + :keyword last_planned_failover_time: The start time of the last planned failover. + :paramtype last_planned_failover_time: ~datetime.datetime + :keyword last_unplanned_failover_time: The start time of the last unplanned failover. + :paramtype last_unplanned_failover_time: ~datetime.datetime + :keyword last_test_failover_time: The start time of the last test failover. + :paramtype last_test_failover_time: ~datetime.datetime + :keyword current_scenario: The current scenario details. + :paramtype current_scenario: + ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails + :keyword current_scenario_status: The recovery plan status. + :paramtype current_scenario_status: str + :keyword current_scenario_status_description: The recovery plan status description. + :paramtype current_scenario_status_description: str + :keyword groups: The recovery plan groups. + :paramtype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] + :keyword provider_specific_details: The provider id and provider specific details. + :paramtype provider_specific_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails] + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.primary_fabric_id = primary_fabric_id self.primary_fabric_friendly_name = primary_fabric_friendly_name @@ -17214,28 +21597,34 @@ def __init__( self.provider_specific_details = provider_specific_details -class RecoveryPlanProtectedItem(msrest.serialization.Model): +class RecoveryPlanProtectedItem(_serialization.Model): """Recovery plan protected item. - :param id: The ARM Id of the recovery plan protected item. - :type id: str - :param virtual_machine_id: The virtual machine Id. - :type virtual_machine_id: str + :ivar id: The ARM Id of the recovery plan protected item. + :vartype id: str + :ivar virtual_machine_id: The virtual machine Id. + :vartype virtual_machine_id: str """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin virtual_machine_id: Optional[str] = None, **kwargs ): - super(RecoveryPlanProtectedItem, self).__init__(**kwargs) + """ + :keyword id: The ARM Id of the recovery plan protected item. + :paramtype id: str + :keyword virtual_machine_id: The virtual machine Id. + :paramtype virtual_machine_id: str + """ + super().__init__(**kwargs) self.id = id self.virtual_machine_id = virtual_machine_id @@ -17245,42 +21634,52 @@ class RecoveryPlanScriptActionDetails(RecoveryPlanActionDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of action details (see - RecoveryPlanActionDetailsTypes enum for possible values).Constant filled by server. - :type instance_type: str - :param path: Required. The script path. - :type path: str - :param timeout: The script timeout. - :type timeout: str - :param fabric_location: Required. The fabric location. Possible values include: "Primary", + :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum + for possible values). Required. + :vartype instance_type: str + :ivar path: The script path. Required. + :vartype path: str + :ivar timeout: The script timeout. + :vartype timeout: str + :ivar fabric_location: The fabric location. Required. Known values are: "Primary" and "Recovery". - :type fabric_location: str or + :vartype fabric_location: str or ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation """ _validation = { - 'instance_type': {'required': True}, - 'path': {'required': True}, - 'fabric_location': {'required': True}, + "instance_type": {"required": True}, + "path": {"required": True}, + "fabric_location": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, - 'timeout': {'key': 'timeout', 'type': 'str'}, - 'fabric_location': {'key': 'fabricLocation', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "timeout": {"key": "timeout", "type": "str"}, + "fabric_location": {"key": "fabricLocation", "type": "str"}, } def __init__( self, *, path: str, - fabric_location: Union[str, "RecoveryPlanActionLocation"], + fabric_location: Union[str, "_models.RecoveryPlanActionLocation"], timeout: Optional[str] = None, **kwargs ): - super(RecoveryPlanScriptActionDetails, self).__init__(**kwargs) - self.instance_type = 'ScriptActionDetails' # type: str + """ + :keyword path: The script path. Required. + :paramtype path: str + :keyword timeout: The script timeout. + :paramtype timeout: str + :keyword fabric_location: The fabric location. Required. Known values are: "Primary" and + "Recovery". + :paramtype fabric_location: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation + """ + super().__init__(**kwargs) + self.instance_type = "ScriptActionDetails" # type: str self.path = path self.timeout = timeout self.fabric_location = fabric_location @@ -17291,236 +21690,277 @@ class RecoveryPlanShutdownGroupTaskDetails(RecoveryPlanGroupTaskDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param child_tasks: The child tasks. - :type child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :param name: The name. - :type name: str - :param group_id: The group identifier. - :type group_id: str - :param rp_group_type: The group type. - :type rp_group_type: str + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar child_tasks: The child tasks. + :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :ivar name: The name. + :vartype name: str + :ivar group_id: The group identifier. + :vartype group_id: str + :ivar rp_group_type: The group type. + :vartype rp_group_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'child_tasks': {'key': 'childTasks', 'type': '[ASRTask]'}, - 'name': {'key': 'name', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'rp_group_type': {'key': 'rpGroupType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "child_tasks": {"key": "childTasks", "type": "[ASRTask]"}, + "name": {"key": "name", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "rp_group_type": {"key": "rpGroupType", "type": "str"}, } def __init__( self, *, - child_tasks: Optional[List["ASRTask"]] = None, + child_tasks: Optional[List["_models.ASRTask"]] = None, name: Optional[str] = None, group_id: Optional[str] = None, rp_group_type: Optional[str] = None, **kwargs ): - super(RecoveryPlanShutdownGroupTaskDetails, self).__init__(child_tasks=child_tasks, name=name, group_id=group_id, rp_group_type=rp_group_type, **kwargs) - self.instance_type = 'RecoveryPlanShutdownGroupTaskDetails' # type: str + """ + :keyword child_tasks: The child tasks. + :paramtype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :keyword name: The name. + :paramtype name: str + :keyword group_id: The group identifier. + :paramtype group_id: str + :keyword rp_group_type: The group type. + :paramtype rp_group_type: str + """ + super().__init__(child_tasks=child_tasks, name=name, group_id=group_id, rp_group_type=rp_group_type, **kwargs) + self.instance_type = "RecoveryPlanShutdownGroupTaskDetails" # type: str -class RecoveryPlanTestFailoverCleanupInput(msrest.serialization.Model): +class RecoveryPlanTestFailoverCleanupInput(_serialization.Model): """Recovery plan test failover cleanup input. All required parameters must be populated in order to send to Azure. - :param properties: Required. The recovery plan test failover cleanup input properties. - :type properties: + :ivar properties: The recovery plan test failover cleanup input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RecoveryPlanTestFailoverCleanupInputProperties'}, + "properties": {"key": "properties", "type": "RecoveryPlanTestFailoverCleanupInputProperties"}, } - def __init__( - self, - *, - properties: "RecoveryPlanTestFailoverCleanupInputProperties", - **kwargs - ): - super(RecoveryPlanTestFailoverCleanupInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.RecoveryPlanTestFailoverCleanupInputProperties", **kwargs): + """ + :keyword properties: The recovery plan test failover cleanup input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class RecoveryPlanTestFailoverCleanupInputProperties(msrest.serialization.Model): +class RecoveryPlanTestFailoverCleanupInputProperties(_serialization.Model): """Recovery plan test failover cleanup input properties. - :param comments: The test failover cleanup comments. - :type comments: str + :ivar comments: The test failover cleanup comments. + :vartype comments: str """ _validation = { - 'comments': {'max_length': 1024, 'min_length': 0}, + "comments": {"max_length": 1024}, } _attribute_map = { - 'comments': {'key': 'comments', 'type': 'str'}, + "comments": {"key": "comments", "type": "str"}, } - def __init__( - self, - *, - comments: Optional[str] = None, - **kwargs - ): - super(RecoveryPlanTestFailoverCleanupInputProperties, self).__init__(**kwargs) + def __init__(self, *, comments: Optional[str] = None, **kwargs): + """ + :keyword comments: The test failover cleanup comments. + :paramtype comments: str + """ + super().__init__(**kwargs) self.comments = comments -class RecoveryPlanTestFailoverInput(msrest.serialization.Model): +class RecoveryPlanTestFailoverInput(_serialization.Model): """Recovery plan test failover input. All required parameters must be populated in order to send to Azure. - :param properties: Required. The recovery plan test failover input properties. - :type properties: + :ivar properties: The recovery plan test failover input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RecoveryPlanTestFailoverInputProperties'}, + "properties": {"key": "properties", "type": "RecoveryPlanTestFailoverInputProperties"}, } - def __init__( - self, - *, - properties: "RecoveryPlanTestFailoverInputProperties", - **kwargs - ): - super(RecoveryPlanTestFailoverInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.RecoveryPlanTestFailoverInputProperties", **kwargs): + """ + :keyword properties: The recovery plan test failover input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class RecoveryPlanTestFailoverInputProperties(msrest.serialization.Model): +class RecoveryPlanTestFailoverInputProperties(_serialization.Model): """Recovery plan test failover input properties. All required parameters must be populated in order to send to Azure. - :param failover_direction: Required. The failover direction. Possible values include: - "PrimaryToRecovery", "RecoveryToPrimary". - :type failover_direction: str or + :ivar failover_direction: The failover direction. Required. Known values are: + "PrimaryToRecovery" and "RecoveryToPrimary". + :vartype failover_direction: str or ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :param network_type: Required. The network type to be used for test failover. - :type network_type: str - :param network_id: The Id of the network to be used for test failover. - :type network_id: str - :param provider_specific_details: The provider specific properties. - :type provider_specific_details: + :ivar network_type: The network type to be used for test failover. Required. + :vartype network_type: str + :ivar network_id: The Id of the network to be used for test failover. + :vartype network_id: str + :ivar provider_specific_details: The provider specific properties. + :vartype provider_specific_details: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] """ _validation = { - 'failover_direction': {'required': True}, - 'network_type': {'required': True}, + "failover_direction": {"required": True}, + "network_type": {"required": True}, } _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'network_type': {'key': 'networkType', 'type': 'str'}, - 'network_id': {'key': 'networkId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': '[RecoveryPlanProviderSpecificFailoverInput]'}, + "failover_direction": {"key": "failoverDirection", "type": "str"}, + "network_type": {"key": "networkType", "type": "str"}, + "network_id": {"key": "networkId", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "[RecoveryPlanProviderSpecificFailoverInput]", + }, } def __init__( self, *, - failover_direction: Union[str, "PossibleOperationsDirections"], + failover_direction: Union[str, "_models.PossibleOperationsDirections"], network_type: str, network_id: Optional[str] = None, - provider_specific_details: Optional[List["RecoveryPlanProviderSpecificFailoverInput"]] = None, - **kwargs - ): - super(RecoveryPlanTestFailoverInputProperties, self).__init__(**kwargs) + provider_specific_details: Optional[List["_models.RecoveryPlanProviderSpecificFailoverInput"]] = None, + **kwargs + ): + """ + :keyword failover_direction: The failover direction. Required. Known values are: + "PrimaryToRecovery" and "RecoveryToPrimary". + :paramtype failover_direction: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections + :keyword network_type: The network type to be used for test failover. Required. + :paramtype network_type: str + :keyword network_id: The Id of the network to be used for test failover. + :paramtype network_id: str + :keyword provider_specific_details: The provider specific properties. + :paramtype provider_specific_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] + """ + super().__init__(**kwargs) self.failover_direction = failover_direction self.network_type = network_type self.network_id = network_id self.provider_specific_details = provider_specific_details -class RecoveryPlanUnplannedFailoverInput(msrest.serialization.Model): +class RecoveryPlanUnplannedFailoverInput(_serialization.Model): """Recovery plan unplanned failover input. All required parameters must be populated in order to send to Azure. - :param properties: Required. The recovery plan unplanned failover input properties. - :type properties: + :ivar properties: The recovery plan unplanned failover input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RecoveryPlanUnplannedFailoverInputProperties'}, + "properties": {"key": "properties", "type": "RecoveryPlanUnplannedFailoverInputProperties"}, } - def __init__( - self, - *, - properties: "RecoveryPlanUnplannedFailoverInputProperties", - **kwargs - ): - super(RecoveryPlanUnplannedFailoverInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.RecoveryPlanUnplannedFailoverInputProperties", **kwargs): + """ + :keyword properties: The recovery plan unplanned failover input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class RecoveryPlanUnplannedFailoverInputProperties(msrest.serialization.Model): +class RecoveryPlanUnplannedFailoverInputProperties(_serialization.Model): """Recovery plan unplanned failover input properties. All required parameters must be populated in order to send to Azure. - :param failover_direction: Required. The failover direction. Possible values include: - "PrimaryToRecovery", "RecoveryToPrimary". - :type failover_direction: str or + :ivar failover_direction: The failover direction. Required. Known values are: + "PrimaryToRecovery" and "RecoveryToPrimary". + :vartype failover_direction: str or ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :param source_site_operations: Required. A value indicating whether source site operations are - required. Possible values include: "Required", "NotRequired". - :type source_site_operations: str or + :ivar source_site_operations: A value indicating whether source site operations are required. + Required. Known values are: "Required" and "NotRequired". + :vartype source_site_operations: str or ~azure.mgmt.recoveryservicessiterecovery.models.SourceSiteOperations - :param provider_specific_details: The provider specific properties. - :type provider_specific_details: + :ivar provider_specific_details: The provider specific properties. + :vartype provider_specific_details: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] """ _validation = { - 'failover_direction': {'required': True}, - 'source_site_operations': {'required': True}, + "failover_direction": {"required": True}, + "source_site_operations": {"required": True}, } _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'source_site_operations': {'key': 'sourceSiteOperations', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': '[RecoveryPlanProviderSpecificFailoverInput]'}, + "failover_direction": {"key": "failoverDirection", "type": "str"}, + "source_site_operations": {"key": "sourceSiteOperations", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "[RecoveryPlanProviderSpecificFailoverInput]", + }, } def __init__( self, *, - failover_direction: Union[str, "PossibleOperationsDirections"], - source_site_operations: Union[str, "SourceSiteOperations"], - provider_specific_details: Optional[List["RecoveryPlanProviderSpecificFailoverInput"]] = None, + failover_direction: Union[str, "_models.PossibleOperationsDirections"], + source_site_operations: Union[str, "_models.SourceSiteOperations"], + provider_specific_details: Optional[List["_models.RecoveryPlanProviderSpecificFailoverInput"]] = None, **kwargs ): - super(RecoveryPlanUnplannedFailoverInputProperties, self).__init__(**kwargs) + """ + :keyword failover_direction: The failover direction. Required. Known values are: + "PrimaryToRecovery" and "RecoveryToPrimary". + :paramtype failover_direction: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections + :keyword source_site_operations: A value indicating whether source site operations are + required. Required. Known values are: "Required" and "NotRequired". + :paramtype source_site_operations: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SourceSiteOperations + :keyword provider_specific_details: The provider specific properties. + :paramtype provider_specific_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] + """ + super().__init__(**kwargs) self.failover_direction = failover_direction self.source_site_operations = source_site_operations self.provider_specific_details = provider_specific_details @@ -17537,79 +21977,87 @@ class RecoveryPoint(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The recovery point properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The recovery point properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RecoveryPointProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "RecoveryPointProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["RecoveryPointProperties"] = None, + properties: Optional["_models.RecoveryPointProperties"] = None, **kwargs ): - super(RecoveryPoint, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The recovery point properties. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class RecoveryPointCollection(msrest.serialization.Model): +class RecoveryPointCollection(_serialization.Model): """Collection of recovery point details. - :param value: The recovery point details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The recovery point details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[RecoveryPoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[RecoveryPoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["RecoveryPoint"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.RecoveryPoint"]] = None, next_link: Optional[str] = None, **kwargs ): - super(RecoveryPointCollection, self).__init__(**kwargs) + """ + :keyword value: The recovery point details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RecoveryPointProperties(msrest.serialization.Model): +class RecoveryPointProperties(_serialization.Model): """Recovery point properties. - :param recovery_point_time: The recovery point time. - :type recovery_point_time: ~datetime.datetime - :param recovery_point_type: The recovery point type: ApplicationConsistent, CrashConsistent. - :type recovery_point_type: str - :param provider_specific_details: The provider specific details for the recovery point. - :type provider_specific_details: + :ivar recovery_point_time: The recovery point time. + :vartype recovery_point_time: ~datetime.datetime + :ivar recovery_point_type: The recovery point type: ApplicationConsistent, CrashConsistent. + :vartype recovery_point_type: str + :ivar provider_specific_details: The provider specific details for the recovery point. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails """ _attribute_map = { - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ProviderSpecificRecoveryPointDetails'}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "ProviderSpecificRecoveryPointDetails"}, } def __init__( @@ -17617,10 +22065,19 @@ def __init__( *, recovery_point_time: Optional[datetime.datetime] = None, recovery_point_type: Optional[str] = None, - provider_specific_details: Optional["ProviderSpecificRecoveryPointDetails"] = None, - **kwargs - ): - super(RecoveryPointProperties, self).__init__(**kwargs) + provider_specific_details: Optional["_models.ProviderSpecificRecoveryPointDetails"] = None, + **kwargs + ): + """ + :keyword recovery_point_time: The recovery point time. + :paramtype recovery_point_time: ~datetime.datetime + :keyword recovery_point_type: The recovery point type: ApplicationConsistent, CrashConsistent. + :paramtype recovery_point_type: str + :keyword provider_specific_details: The provider specific details for the recovery point. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails + """ + super().__init__(**kwargs) self.recovery_point_time = recovery_point_time self.recovery_point_type = recovery_point_type self.provider_specific_details = provider_specific_details @@ -17637,134 +22094,153 @@ class RecoveryServicesProvider(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Provider properties. - :type properties: + :ivar location: Resource Location. + :vartype location: str + :ivar properties: Provider properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RecoveryServicesProviderProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "RecoveryServicesProviderProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["RecoveryServicesProviderProperties"] = None, + properties: Optional["_models.RecoveryServicesProviderProperties"] = None, **kwargs ): - super(RecoveryServicesProvider, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: Provider properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class RecoveryServicesProviderCollection(msrest.serialization.Model): +class RecoveryServicesProviderCollection(_serialization.Model): """Collection of providers. - :param value: The Servers details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The Servers details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[RecoveryServicesProvider]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[RecoveryServicesProvider]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["RecoveryServicesProvider"]] = None, + value: Optional[List["_models.RecoveryServicesProvider"]] = None, next_link: Optional[str] = None, **kwargs ): - super(RecoveryServicesProviderCollection, self).__init__(**kwargs) + """ + :keyword value: The Servers details. + :paramtype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class RecoveryServicesProviderProperties(msrest.serialization.Model): +class RecoveryServicesProviderProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Recovery services provider properties. - :param fabric_type: Type of the site. - :type fabric_type: str - :param friendly_name: Friendly name of the DRA. - :type friendly_name: str - :param provider_version: The provider version. - :type provider_version: str - :param server_version: The fabric provider. - :type server_version: str - :param provider_version_state: DRA version status. - :type provider_version_state: str - :param provider_version_expiry_date: Expiry date of the version. - :type provider_version_expiry_date: ~datetime.datetime - :param fabric_friendly_name: The fabric friendly name. - :type fabric_friendly_name: str - :param last_heart_beat: Time when last heartbeat was sent by the DRA. - :type last_heart_beat: ~datetime.datetime - :param connection_status: A value indicating whether DRA is responsive. - :type connection_status: str - :param protected_item_count: Number of protected VMs currently managed by the DRA. - :type protected_item_count: int - :param allowed_scenarios: The scenarios allowed on this provider. - :type allowed_scenarios: list[str] - :param health_error_details: The recovery services provider health error details. - :type health_error_details: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param dra_identifier: The DRA Id. - :type dra_identifier: str - :param machine_id: The machine Id. - :type machine_id: str - :param machine_name: The machine name. - :type machine_name: str - :param bios_id: The Bios Id. - :type bios_id: str - :param authentication_identity_details: The authentication identity details. - :type authentication_identity_details: + :ivar fabric_type: Type of the site. + :vartype fabric_type: str + :ivar friendly_name: Friendly name of the DRA. + :vartype friendly_name: str + :ivar provider_version: The provider version. + :vartype provider_version: str + :ivar server_version: The fabric provider. + :vartype server_version: str + :ivar provider_version_state: DRA version status. + :vartype provider_version_state: str + :ivar provider_version_expiry_date: Expiry date of the version. + :vartype provider_version_expiry_date: ~datetime.datetime + :ivar fabric_friendly_name: The fabric friendly name. + :vartype fabric_friendly_name: str + :ivar last_heart_beat: Time when last heartbeat was sent by the DRA. + :vartype last_heart_beat: ~datetime.datetime + :ivar connection_status: A value indicating whether DRA is responsive. + :vartype connection_status: str + :ivar protected_item_count: Number of protected VMs currently managed by the DRA. + :vartype protected_item_count: int + :ivar allowed_scenarios: The scenarios allowed on this provider. + :vartype allowed_scenarios: list[str] + :ivar health_error_details: The recovery services provider health error details. + :vartype health_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar dra_identifier: The DRA Id. + :vartype dra_identifier: str + :ivar machine_id: The machine Id. + :vartype machine_id: str + :ivar machine_name: The machine name. + :vartype machine_name: str + :ivar bios_id: The Bios Id. + :vartype bios_id: str + :ivar authentication_identity_details: The authentication identity details. + :vartype authentication_identity_details: ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :param resource_access_identity_details: The resource access identity details. - :type resource_access_identity_details: + :ivar resource_access_identity_details: The resource access identity details. + :vartype resource_access_identity_details: ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :param data_plane_authentication_identity_details: The data plane authentication identity + :ivar data_plane_authentication_identity_details: The data plane authentication identity details. - :type data_plane_authentication_identity_details: + :vartype data_plane_authentication_identity_details: ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :param provider_version_details: The provider version details. - :type provider_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - - _attribute_map = { - 'fabric_type': {'key': 'fabricType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'provider_version': {'key': 'providerVersion', 'type': 'str'}, - 'server_version': {'key': 'serverVersion', 'type': 'str'}, - 'provider_version_state': {'key': 'providerVersionState', 'type': 'str'}, - 'provider_version_expiry_date': {'key': 'providerVersionExpiryDate', 'type': 'iso-8601'}, - 'fabric_friendly_name': {'key': 'fabricFriendlyName', 'type': 'str'}, - 'last_heart_beat': {'key': 'lastHeartBeat', 'type': 'iso-8601'}, - 'connection_status': {'key': 'connectionStatus', 'type': 'str'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'int'}, - 'allowed_scenarios': {'key': 'allowedScenarios', 'type': '[str]'}, - 'health_error_details': {'key': 'healthErrorDetails', 'type': '[HealthError]'}, - 'dra_identifier': {'key': 'draIdentifier', 'type': 'str'}, - 'machine_id': {'key': 'machineId', 'type': 'str'}, - 'machine_name': {'key': 'machineName', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'authentication_identity_details': {'key': 'authenticationIdentityDetails', 'type': 'IdentityProviderDetails'}, - 'resource_access_identity_details': {'key': 'resourceAccessIdentityDetails', 'type': 'IdentityProviderDetails'}, - 'data_plane_authentication_identity_details': {'key': 'dataPlaneAuthenticationIdentityDetails', 'type': 'IdentityProviderDetails'}, - 'provider_version_details': {'key': 'providerVersionDetails', 'type': 'VersionDetails'}, + :ivar provider_version_details: The provider version details. + :vartype provider_version_details: + ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + """ + + _attribute_map = { + "fabric_type": {"key": "fabricType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "provider_version": {"key": "providerVersion", "type": "str"}, + "server_version": {"key": "serverVersion", "type": "str"}, + "provider_version_state": {"key": "providerVersionState", "type": "str"}, + "provider_version_expiry_date": {"key": "providerVersionExpiryDate", "type": "iso-8601"}, + "fabric_friendly_name": {"key": "fabricFriendlyName", "type": "str"}, + "last_heart_beat": {"key": "lastHeartBeat", "type": "iso-8601"}, + "connection_status": {"key": "connectionStatus", "type": "str"}, + "protected_item_count": {"key": "protectedItemCount", "type": "int"}, + "allowed_scenarios": {"key": "allowedScenarios", "type": "[str]"}, + "health_error_details": {"key": "healthErrorDetails", "type": "[HealthError]"}, + "dra_identifier": {"key": "draIdentifier", "type": "str"}, + "machine_id": {"key": "machineId", "type": "str"}, + "machine_name": {"key": "machineName", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "authentication_identity_details": {"key": "authenticationIdentityDetails", "type": "IdentityProviderDetails"}, + "resource_access_identity_details": {"key": "resourceAccessIdentityDetails", "type": "IdentityProviderDetails"}, + "data_plane_authentication_identity_details": { + "key": "dataPlaneAuthenticationIdentityDetails", + "type": "IdentityProviderDetails", + }, + "provider_version_details": {"key": "providerVersionDetails", "type": "VersionDetails"}, } def __init__( @@ -17781,18 +22257,66 @@ def __init__( connection_status: Optional[str] = None, protected_item_count: Optional[int] = None, allowed_scenarios: Optional[List[str]] = None, - health_error_details: Optional[List["HealthError"]] = None, + health_error_details: Optional[List["_models.HealthError"]] = None, dra_identifier: Optional[str] = None, machine_id: Optional[str] = None, machine_name: Optional[str] = None, bios_id: Optional[str] = None, - authentication_identity_details: Optional["IdentityProviderDetails"] = None, - resource_access_identity_details: Optional["IdentityProviderDetails"] = None, - data_plane_authentication_identity_details: Optional["IdentityProviderDetails"] = None, - provider_version_details: Optional["VersionDetails"] = None, - **kwargs - ): - super(RecoveryServicesProviderProperties, self).__init__(**kwargs) + authentication_identity_details: Optional["_models.IdentityProviderDetails"] = None, + resource_access_identity_details: Optional["_models.IdentityProviderDetails"] = None, + data_plane_authentication_identity_details: Optional["_models.IdentityProviderDetails"] = None, + provider_version_details: Optional["_models.VersionDetails"] = None, + **kwargs + ): + """ + :keyword fabric_type: Type of the site. + :paramtype fabric_type: str + :keyword friendly_name: Friendly name of the DRA. + :paramtype friendly_name: str + :keyword provider_version: The provider version. + :paramtype provider_version: str + :keyword server_version: The fabric provider. + :paramtype server_version: str + :keyword provider_version_state: DRA version status. + :paramtype provider_version_state: str + :keyword provider_version_expiry_date: Expiry date of the version. + :paramtype provider_version_expiry_date: ~datetime.datetime + :keyword fabric_friendly_name: The fabric friendly name. + :paramtype fabric_friendly_name: str + :keyword last_heart_beat: Time when last heartbeat was sent by the DRA. + :paramtype last_heart_beat: ~datetime.datetime + :keyword connection_status: A value indicating whether DRA is responsive. + :paramtype connection_status: str + :keyword protected_item_count: Number of protected VMs currently managed by the DRA. + :paramtype protected_item_count: int + :keyword allowed_scenarios: The scenarios allowed on this provider. + :paramtype allowed_scenarios: list[str] + :keyword health_error_details: The recovery services provider health error details. + :paramtype health_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword dra_identifier: The DRA Id. + :paramtype dra_identifier: str + :keyword machine_id: The machine Id. + :paramtype machine_id: str + :keyword machine_name: The machine name. + :paramtype machine_name: str + :keyword bios_id: The Bios Id. + :paramtype bios_id: str + :keyword authentication_identity_details: The authentication identity details. + :paramtype authentication_identity_details: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails + :keyword resource_access_identity_details: The resource access identity details. + :paramtype resource_access_identity_details: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails + :keyword data_plane_authentication_identity_details: The data plane authentication identity + details. + :paramtype data_plane_authentication_identity_details: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails + :keyword provider_version_details: The provider version details. + :paramtype provider_version_details: + ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + """ + super().__init__(**kwargs) self.fabric_type = fabric_type self.friendly_name = friendly_name self.provider_version = provider_version @@ -17815,139 +22339,152 @@ def __init__( self.provider_version_details = provider_version_details -class RemoveDisksInput(msrest.serialization.Model): +class RemoveDisksInput(_serialization.Model): """Input for remove disk(s) operation. - :param properties: Remove disk input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInputProperties + :ivar properties: Remove disk input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RemoveDisksInputProperties'}, + "properties": {"key": "properties", "type": "RemoveDisksInputProperties"}, } - def __init__( - self, - *, - properties: Optional["RemoveDisksInputProperties"] = None, - **kwargs - ): - super(RemoveDisksInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.RemoveDisksInputProperties"] = None, **kwargs): + """ + :keyword properties: Remove disk input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class RemoveDisksInputProperties(msrest.serialization.Model): +class RemoveDisksInputProperties(_serialization.Model): """Remove Disk input properties. - :param provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure - provider, it will be AzureEnableProtectionInput object. For San provider, it will be + :ivar provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure provider, + it will be AzureEnableProtectionInput object. For San provider, it will be SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :type provider_specific_details: + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput """ _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'RemoveDisksProviderSpecificInput'}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "RemoveDisksProviderSpecificInput"}, } def __init__( - self, - *, - provider_specific_details: Optional["RemoveDisksProviderSpecificInput"] = None, - **kwargs + self, *, provider_specific_details: Optional["_models.RemoveDisksProviderSpecificInput"] = None, **kwargs ): - super(RemoveDisksInputProperties, self).__init__(**kwargs) + """ + :keyword provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure + provider, it will be AzureEnableProtectionInput object. For San provider, it will be + SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput + """ + super().__init__(**kwargs) self.provider_specific_details = provider_specific_details -class RemoveProtectionContainerMappingInput(msrest.serialization.Model): +class RemoveProtectionContainerMappingInput(_serialization.Model): """Container unpairing input. - :param properties: Configure protection input properties. - :type properties: + :ivar properties: Configure protection input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RemoveProtectionContainerMappingInputProperties'}, + "properties": {"key": "properties", "type": "RemoveProtectionContainerMappingInputProperties"}, } def __init__( - self, - *, - properties: Optional["RemoveProtectionContainerMappingInputProperties"] = None, - **kwargs + self, *, properties: Optional["_models.RemoveProtectionContainerMappingInputProperties"] = None, **kwargs ): - super(RemoveProtectionContainerMappingInput, self).__init__(**kwargs) + """ + :keyword properties: Configure protection input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class RemoveProtectionContainerMappingInputProperties(msrest.serialization.Model): +class RemoveProtectionContainerMappingInputProperties(_serialization.Model): """Unpairing input properties. - :param provider_specific_input: Provider specific input for unpairing. - :type provider_specific_input: + :ivar provider_specific_input: Provider specific input for unpairing. + :vartype provider_specific_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput """ _attribute_map = { - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': 'ReplicationProviderContainerUnmappingInput'}, + "provider_specific_input": { + "key": "providerSpecificInput", + "type": "ReplicationProviderContainerUnmappingInput", + }, } def __init__( self, *, - provider_specific_input: Optional["ReplicationProviderContainerUnmappingInput"] = None, + provider_specific_input: Optional["_models.ReplicationProviderContainerUnmappingInput"] = None, **kwargs ): - super(RemoveProtectionContainerMappingInputProperties, self).__init__(**kwargs) + """ + :keyword provider_specific_input: Provider specific input for unpairing. + :paramtype provider_specific_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput + """ + super().__init__(**kwargs) self.provider_specific_input = provider_specific_input -class RenewCertificateInput(msrest.serialization.Model): +class RenewCertificateInput(_serialization.Model): """Certificate renewal input. - :param properties: Renew certificate input properties. - :type properties: + :ivar properties: Renew certificate input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RenewCertificateInputProperties'}, + "properties": {"key": "properties", "type": "RenewCertificateInputProperties"}, } - def __init__( - self, - *, - properties: Optional["RenewCertificateInputProperties"] = None, - **kwargs - ): - super(RenewCertificateInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.RenewCertificateInputProperties"] = None, **kwargs): + """ + :keyword properties: Renew certificate input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class RenewCertificateInputProperties(msrest.serialization.Model): +class RenewCertificateInputProperties(_serialization.Model): """Renew Certificate input properties. - :param renew_certificate_type: Renew certificate type. - :type renew_certificate_type: str + :ivar renew_certificate_type: Renew certificate type. + :vartype renew_certificate_type: str """ _attribute_map = { - 'renew_certificate_type': {'key': 'renewCertificateType', 'type': 'str'}, + "renew_certificate_type": {"key": "renewCertificateType", "type": "str"}, } - def __init__( - self, - *, - renew_certificate_type: Optional[str] = None, - **kwargs - ): - super(RenewCertificateInputProperties, self).__init__(**kwargs) + def __init__(self, *, renew_certificate_type: Optional[str] = None, **kwargs): + """ + :keyword renew_certificate_type: Renew certificate type. + :paramtype renew_certificate_type: str + """ + super().__init__(**kwargs) self.renew_certificate_type = renew_certificate_type -class ReplicationAgentDetails(msrest.serialization.Model): +class ReplicationAgentDetails(_serialization.Model): """Replication agent details. Variables are only populated by the server, and will be ignored when sending a request. @@ -17966,42 +22503,40 @@ class ReplicationAgentDetails(msrest.serialization.Model): :vartype version: str :ivar last_heartbeat_utc: The last heartbeat received from the replication agent. :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the replication agent. Possible values include: "None", "Normal", - "Warning", "Critical". + :ivar health: The health of the replication agent. Known values are: "None", "Normal", + "Warning", and "Critical". :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth :ivar health_errors: The health errors. :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "bios_id": {"readonly": True}, + "fabric_object_id": {"readonly": True}, + "fqdn": {"readonly": True}, + "version": {"readonly": True}, + "last_heartbeat_utc": {"readonly": True}, + "health": {"readonly": True}, + "health_errors": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "health": {"key": "health", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, } - def __init__( - self, - **kwargs - ): - super(ReplicationAgentDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.bios_id = None @@ -18013,7 +22548,51 @@ def __init__( self.health_errors = None -class ReplicationEligibilityResults(msrest.serialization.Model): +class ReplicationAppliance(_serialization.Model): + """Replication appliance definition. + + :ivar properties: Appliance related data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationApplianceProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ReplicationApplianceProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ReplicationApplianceProperties"] = None, **kwargs): + """ + :keyword properties: Appliance related data. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationApplianceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ReplicationApplianceProperties(_serialization.Model): + """Replication appliance properties. + + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceSpecificDetails + """ + + _attribute_map = { + "provider_specific_details": {"key": "providerSpecificDetails", "type": "ApplianceSpecificDetails"}, + } + + def __init__(self, *, provider_specific_details: Optional["_models.ApplianceSpecificDetails"] = None, **kwargs): + """ + :keyword provider_specific_details: Provider specific settings. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceSpecificDetails + """ + super().__init__(**kwargs) + self.provider_specific_details = provider_specific_details + + +class ReplicationEligibilityResults(_serialization.Model): """Replication eligibility results response model. Variables are only populated by the server, and will be ignored when sending a request. @@ -18030,79 +22609,77 @@ class ReplicationEligibilityResults(msrest.serialization.Model): """ _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'id': {'readonly': True}, - 'properties': {'readonly': True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "id": {"readonly": True}, + "properties": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ReplicationEligibilityResultsProperties'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "properties": {"key": "properties", "type": "ReplicationEligibilityResultsProperties"}, } - def __init__( - self, - **kwargs - ): - super(ReplicationEligibilityResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.type = None self.id = None self.properties = None -class ReplicationEligibilityResultsCollection(msrest.serialization.Model): +class ReplicationEligibilityResultsCollection(_serialization.Model): """Replication eligibility results collection response model. - :param value: The replication eligibility results details. - :type value: + :ivar value: The replication eligibility results details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ReplicationEligibilityResults]'}, + "value": {"key": "value", "type": "[ReplicationEligibilityResults]"}, } - def __init__( - self, - *, - value: Optional[List["ReplicationEligibilityResults"]] = None, - **kwargs - ): - super(ReplicationEligibilityResultsCollection, self).__init__(**kwargs) + def __init__(self, *, value: Optional[List["_models.ReplicationEligibilityResults"]] = None, **kwargs): + """ + :keyword value: The replication eligibility results details. + :paramtype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults] + """ + super().__init__(**kwargs) self.value = value -class ReplicationEligibilityResultsErrorInfo(msrest.serialization.Model): +class ReplicationEligibilityResultsErrorInfo(_serialization.Model): """Error model that can be exposed to the user. Variables are only populated by the server, and will be ignored when sending a request. - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param possible_causes: The possible causes. - :type possible_causes: str - :param recommended_action: The recommended action. - :type recommended_action: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str :ivar status: The error status. :vartype status: str """ _validation = { - 'status': {'readonly': True}, + "status": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "status": {"key": "status", "type": "str"}, } def __init__( @@ -18114,7 +22691,17 @@ def __init__( recommended_action: Optional[str] = None, **kwargs ): - super(ReplicationEligibilityResultsErrorInfo, self).__init__(**kwargs) + """ + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + :keyword possible_causes: The possible causes. + :paramtype possible_causes: str + :keyword recommended_action: The recommended action. + :paramtype recommended_action: str + """ + super().__init__(**kwargs) self.code = code self.message = message self.possible_causes = possible_causes @@ -18122,34 +22709,34 @@ def __init__( self.status = None -class ReplicationEligibilityResultsProperties(msrest.serialization.Model): +class ReplicationEligibilityResultsProperties(_serialization.Model): """Properties model for replication eligibility results API. Variables are only populated by the server, and will be ignored when sending a request. :ivar client_request_id: The client request Id. :vartype client_request_id: str - :param errors: The error details. - :type errors: + :ivar errors: The error details. + :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsErrorInfo] """ _validation = { - 'client_request_id': {'readonly': True}, + "client_request_id": {"readonly": True}, } _attribute_map = { - 'client_request_id': {'key': 'clientRequestId', 'type': 'str'}, - 'errors': {'key': 'errors', 'type': '[ReplicationEligibilityResultsErrorInfo]'}, + "client_request_id": {"key": "clientRequestId", "type": "str"}, + "errors": {"key": "errors", "type": "[ReplicationEligibilityResultsErrorInfo]"}, } - def __init__( - self, - *, - errors: Optional[List["ReplicationEligibilityResultsErrorInfo"]] = None, - **kwargs - ): - super(ReplicationEligibilityResultsProperties, self).__init__(**kwargs) + def __init__(self, *, errors: Optional[List["_models.ReplicationEligibilityResultsErrorInfo"]] = None, **kwargs): + """ + :keyword errors: The error details. + :paramtype errors: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsErrorInfo] + """ + super().__init__(**kwargs) self.client_request_id = None self.errors = errors @@ -18159,25 +22746,22 @@ class ReplicationGroupDetails(ConfigurationSettings): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(ReplicationGroupDetails, self).__init__(**kwargs) - self.instance_type = 'ReplicationGroupDetails' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "ReplicationGroupDetails" # type: str class ReplicationProtectedItem(Resource): @@ -18191,162 +22775,186 @@ class ReplicationProtectedItem(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The custom data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ReplicationProtectedItemProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ReplicationProtectedItemProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["ReplicationProtectedItemProperties"] = None, + properties: Optional["_models.ReplicationProtectedItemProperties"] = None, **kwargs ): - super(ReplicationProtectedItem, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The custom data. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class ReplicationProtectedItemCollection(msrest.serialization.Model): +class ReplicationProtectedItemCollection(_serialization.Model): """Replication protected item collection. - :param value: The Replication protected item details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The Replication protected item details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ReplicationProtectedItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ReplicationProtectedItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["ReplicationProtectedItem"]] = None, + value: Optional[List["_models.ReplicationProtectedItem"]] = None, next_link: Optional[str] = None, **kwargs ): - super(ReplicationProtectedItemCollection, self).__init__(**kwargs) + """ + :keyword value: The Replication protected item details. + :paramtype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class ReplicationProtectedItemProperties(msrest.serialization.Model): +class ReplicationProtectedItemProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Replication protected item custom data details. - :param friendly_name: The name. - :type friendly_name: str - :param protected_item_type: The type of protected item type. - :type protected_item_type: str - :param protectable_item_id: The protected item ARM Id. - :type protectable_item_id: str - :param recovery_services_provider_id: The recovery provider ARM Id. - :type recovery_services_provider_id: str - :param primary_fabric_friendly_name: The friendly name of the primary fabric. - :type primary_fabric_friendly_name: str - :param primary_fabric_provider: The fabric provider of the primary fabric. - :type primary_fabric_provider: str - :param recovery_fabric_friendly_name: The friendly name of recovery fabric. - :type recovery_fabric_friendly_name: str - :param recovery_fabric_id: The Arm Id of recovery fabric. - :type recovery_fabric_id: str - :param primary_protection_container_friendly_name: The name of primary protection container + :ivar friendly_name: The name. + :vartype friendly_name: str + :ivar protected_item_type: The type of protected item type. + :vartype protected_item_type: str + :ivar protectable_item_id: The protected item ARM Id. + :vartype protectable_item_id: str + :ivar recovery_services_provider_id: The recovery provider ARM Id. + :vartype recovery_services_provider_id: str + :ivar primary_fabric_friendly_name: The friendly name of the primary fabric. + :vartype primary_fabric_friendly_name: str + :ivar primary_fabric_provider: The fabric provider of the primary fabric. + :vartype primary_fabric_provider: str + :ivar recovery_fabric_friendly_name: The friendly name of recovery fabric. + :vartype recovery_fabric_friendly_name: str + :ivar recovery_fabric_id: The Arm Id of recovery fabric. + :vartype recovery_fabric_id: str + :ivar primary_protection_container_friendly_name: The name of primary protection container friendly name. - :type primary_protection_container_friendly_name: str - :param recovery_protection_container_friendly_name: The name of recovery container friendly + :vartype primary_protection_container_friendly_name: str + :ivar recovery_protection_container_friendly_name: The name of recovery container friendly name. - :type recovery_protection_container_friendly_name: str - :param protection_state: The protection status. - :type protection_state: str - :param protection_state_description: The protection state description. - :type protection_state_description: str - :param active_location: The Current active location of the PE. - :type active_location: str - :param test_failover_state: The Test failover state. - :type test_failover_state: str - :param test_failover_state_description: The Test failover state description. - :type test_failover_state_description: str - :param allowed_operations: The allowed operations on the Replication protected item. - :type allowed_operations: list[str] - :param replication_health: The consolidated protection health for the VM taking any issues with + :vartype recovery_protection_container_friendly_name: str + :ivar protection_state: The protection status. + :vartype protection_state: str + :ivar protection_state_description: The protection state description. + :vartype protection_state_description: str + :ivar active_location: The Current active location of the PE. + :vartype active_location: str + :ivar test_failover_state: The Test failover state. + :vartype test_failover_state: str + :ivar test_failover_state_description: The Test failover state description. + :vartype test_failover_state_description: str + :ivar switch_provider_state: The switch provider state. + :vartype switch_provider_state: str + :ivar switch_provider_state_description: The switch provider state description. + :vartype switch_provider_state_description: str + :ivar allowed_operations: The allowed operations on the Replication protected item. + :vartype allowed_operations: list[str] + :ivar replication_health: The consolidated protection health for the VM taking any issues with SRS as well as all the replication units associated with the VM's replication group into account. This is a string representation of the ProtectionHealth enumeration. - :type replication_health: str - :param failover_health: The consolidated failover health for the VM. - :type failover_health: str - :param health_errors: List of health errors. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param policy_id: The ID of Policy governing this PE. - :type policy_id: str - :param policy_friendly_name: The name of Policy governing this PE. - :type policy_friendly_name: str - :param last_successful_failover_time: The Last successful failover time. - :type last_successful_failover_time: ~datetime.datetime - :param last_successful_test_failover_time: The Last successful test failover time. - :type last_successful_test_failover_time: ~datetime.datetime - :param current_scenario: The current scenario. - :type current_scenario: ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :param failover_recovery_point_id: The recovery point ARM Id to which the Vm was failed over. - :type failover_recovery_point_id: str - :param provider_specific_details: The Replication provider custom settings. - :type provider_specific_details: + :vartype replication_health: str + :ivar failover_health: The consolidated failover health for the VM. + :vartype failover_health: str + :ivar health_errors: List of health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar policy_id: The ID of Policy governing this PE. + :vartype policy_id: str + :ivar policy_friendly_name: The name of Policy governing this PE. + :vartype policy_friendly_name: str + :ivar last_successful_failover_time: The Last successful failover time. + :vartype last_successful_failover_time: ~datetime.datetime + :ivar last_successful_test_failover_time: The Last successful test failover time. + :vartype last_successful_test_failover_time: ~datetime.datetime + :ivar current_scenario: The current scenario. + :vartype current_scenario: + ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails + :ivar failover_recovery_point_id: The recovery point ARM Id to which the Vm was failed over. + :vartype failover_recovery_point_id: str + :ivar provider_specific_details: The Replication provider custom settings. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificSettings - :param recovery_container_id: The recovery container Id. - :type recovery_container_id: str - :param event_correlation_id: The correlation Id for events associated with this protected item. - :type event_correlation_id: str - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'protectable_item_id': {'key': 'protectableItemId', 'type': 'str'}, - 'recovery_services_provider_id': {'key': 'recoveryServicesProviderId', 'type': 'str'}, - 'primary_fabric_friendly_name': {'key': 'primaryFabricFriendlyName', 'type': 'str'}, - 'primary_fabric_provider': {'key': 'primaryFabricProvider', 'type': 'str'}, - 'recovery_fabric_friendly_name': {'key': 'recoveryFabricFriendlyName', 'type': 'str'}, - 'recovery_fabric_id': {'key': 'recoveryFabricId', 'type': 'str'}, - 'primary_protection_container_friendly_name': {'key': 'primaryProtectionContainerFriendlyName', 'type': 'str'}, - 'recovery_protection_container_friendly_name': {'key': 'recoveryProtectionContainerFriendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'protection_state_description': {'key': 'protectionStateDescription', 'type': 'str'}, - 'active_location': {'key': 'activeLocation', 'type': 'str'}, - 'test_failover_state': {'key': 'testFailoverState', 'type': 'str'}, - 'test_failover_state_description': {'key': 'testFailoverStateDescription', 'type': 'str'}, - 'allowed_operations': {'key': 'allowedOperations', 'type': '[str]'}, - 'replication_health': {'key': 'replicationHealth', 'type': 'str'}, - 'failover_health': {'key': 'failoverHealth', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'policy_friendly_name': {'key': 'policyFriendlyName', 'type': 'str'}, - 'last_successful_failover_time': {'key': 'lastSuccessfulFailoverTime', 'type': 'iso-8601'}, - 'last_successful_test_failover_time': {'key': 'lastSuccessfulTestFailoverTime', 'type': 'iso-8601'}, - 'current_scenario': {'key': 'currentScenario', 'type': 'CurrentScenarioDetails'}, - 'failover_recovery_point_id': {'key': 'failoverRecoveryPointId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ReplicationProviderSpecificSettings'}, - 'recovery_container_id': {'key': 'recoveryContainerId', 'type': 'str'}, - 'event_correlation_id': {'key': 'eventCorrelationId', 'type': 'str'}, - } + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar event_correlation_id: The correlation Id for events associated with this protected item. + :vartype event_correlation_id: str + """ - def __init__( + _attribute_map = { + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "protectable_item_id": {"key": "protectableItemId", "type": "str"}, + "recovery_services_provider_id": {"key": "recoveryServicesProviderId", "type": "str"}, + "primary_fabric_friendly_name": {"key": "primaryFabricFriendlyName", "type": "str"}, + "primary_fabric_provider": {"key": "primaryFabricProvider", "type": "str"}, + "recovery_fabric_friendly_name": {"key": "recoveryFabricFriendlyName", "type": "str"}, + "recovery_fabric_id": {"key": "recoveryFabricId", "type": "str"}, + "primary_protection_container_friendly_name": {"key": "primaryProtectionContainerFriendlyName", "type": "str"}, + "recovery_protection_container_friendly_name": { + "key": "recoveryProtectionContainerFriendlyName", + "type": "str", + }, + "protection_state": {"key": "protectionState", "type": "str"}, + "protection_state_description": {"key": "protectionStateDescription", "type": "str"}, + "active_location": {"key": "activeLocation", "type": "str"}, + "test_failover_state": {"key": "testFailoverState", "type": "str"}, + "test_failover_state_description": {"key": "testFailoverStateDescription", "type": "str"}, + "switch_provider_state": {"key": "switchProviderState", "type": "str"}, + "switch_provider_state_description": {"key": "switchProviderStateDescription", "type": "str"}, + "allowed_operations": {"key": "allowedOperations", "type": "[str]"}, + "replication_health": {"key": "replicationHealth", "type": "str"}, + "failover_health": {"key": "failoverHealth", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, + "policy_id": {"key": "policyId", "type": "str"}, + "policy_friendly_name": {"key": "policyFriendlyName", "type": "str"}, + "last_successful_failover_time": {"key": "lastSuccessfulFailoverTime", "type": "iso-8601"}, + "last_successful_test_failover_time": {"key": "lastSuccessfulTestFailoverTime", "type": "iso-8601"}, + "current_scenario": {"key": "currentScenario", "type": "CurrentScenarioDetails"}, + "failover_recovery_point_id": {"key": "failoverRecoveryPointId", "type": "str"}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "ReplicationProviderSpecificSettings"}, + "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, + "event_correlation_id": {"key": "eventCorrelationId", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, friendly_name: Optional[str] = None, @@ -18364,22 +22972,93 @@ def __init__( active_location: Optional[str] = None, test_failover_state: Optional[str] = None, test_failover_state_description: Optional[str] = None, + switch_provider_state: Optional[str] = None, + switch_provider_state_description: Optional[str] = None, allowed_operations: Optional[List[str]] = None, replication_health: Optional[str] = None, failover_health: Optional[str] = None, - health_errors: Optional[List["HealthError"]] = None, + health_errors: Optional[List["_models.HealthError"]] = None, policy_id: Optional[str] = None, policy_friendly_name: Optional[str] = None, last_successful_failover_time: Optional[datetime.datetime] = None, last_successful_test_failover_time: Optional[datetime.datetime] = None, - current_scenario: Optional["CurrentScenarioDetails"] = None, + current_scenario: Optional["_models.CurrentScenarioDetails"] = None, failover_recovery_point_id: Optional[str] = None, - provider_specific_details: Optional["ReplicationProviderSpecificSettings"] = None, + provider_specific_details: Optional["_models.ReplicationProviderSpecificSettings"] = None, recovery_container_id: Optional[str] = None, event_correlation_id: Optional[str] = None, **kwargs ): - super(ReplicationProtectedItemProperties, self).__init__(**kwargs) + """ + :keyword friendly_name: The name. + :paramtype friendly_name: str + :keyword protected_item_type: The type of protected item type. + :paramtype protected_item_type: str + :keyword protectable_item_id: The protected item ARM Id. + :paramtype protectable_item_id: str + :keyword recovery_services_provider_id: The recovery provider ARM Id. + :paramtype recovery_services_provider_id: str + :keyword primary_fabric_friendly_name: The friendly name of the primary fabric. + :paramtype primary_fabric_friendly_name: str + :keyword primary_fabric_provider: The fabric provider of the primary fabric. + :paramtype primary_fabric_provider: str + :keyword recovery_fabric_friendly_name: The friendly name of recovery fabric. + :paramtype recovery_fabric_friendly_name: str + :keyword recovery_fabric_id: The Arm Id of recovery fabric. + :paramtype recovery_fabric_id: str + :keyword primary_protection_container_friendly_name: The name of primary protection container + friendly name. + :paramtype primary_protection_container_friendly_name: str + :keyword recovery_protection_container_friendly_name: The name of recovery container friendly + name. + :paramtype recovery_protection_container_friendly_name: str + :keyword protection_state: The protection status. + :paramtype protection_state: str + :keyword protection_state_description: The protection state description. + :paramtype protection_state_description: str + :keyword active_location: The Current active location of the PE. + :paramtype active_location: str + :keyword test_failover_state: The Test failover state. + :paramtype test_failover_state: str + :keyword test_failover_state_description: The Test failover state description. + :paramtype test_failover_state_description: str + :keyword switch_provider_state: The switch provider state. + :paramtype switch_provider_state: str + :keyword switch_provider_state_description: The switch provider state description. + :paramtype switch_provider_state_description: str + :keyword allowed_operations: The allowed operations on the Replication protected item. + :paramtype allowed_operations: list[str] + :keyword replication_health: The consolidated protection health for the VM taking any issues + with SRS as well as all the replication units associated with the VM's replication group into + account. This is a string representation of the ProtectionHealth enumeration. + :paramtype replication_health: str + :keyword failover_health: The consolidated failover health for the VM. + :paramtype failover_health: str + :keyword health_errors: List of health errors. + :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword policy_id: The ID of Policy governing this PE. + :paramtype policy_id: str + :keyword policy_friendly_name: The name of Policy governing this PE. + :paramtype policy_friendly_name: str + :keyword last_successful_failover_time: The Last successful failover time. + :paramtype last_successful_failover_time: ~datetime.datetime + :keyword last_successful_test_failover_time: The Last successful test failover time. + :paramtype last_successful_test_failover_time: ~datetime.datetime + :keyword current_scenario: The current scenario. + :paramtype current_scenario: + ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails + :keyword failover_recovery_point_id: The recovery point ARM Id to which the Vm was failed over. + :paramtype failover_recovery_point_id: str + :keyword provider_specific_details: The Replication provider custom settings. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificSettings + :keyword recovery_container_id: The recovery container Id. + :paramtype recovery_container_id: str + :keyword event_correlation_id: The correlation Id for events associated with this protected + item. + :paramtype event_correlation_id: str + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.protected_item_type = protected_item_type self.protectable_item_id = protectable_item_id @@ -18395,6 +23074,8 @@ def __init__( self.active_location = active_location self.test_failover_state = test_failover_state self.test_failover_state_description = test_failover_state_description + self.switch_provider_state = switch_provider_state + self.switch_provider_state_description = switch_provider_state_description self.allowed_operations = allowed_operations self.replication_health = replication_health self.failover_health = failover_health @@ -18421,71 +23102,86 @@ class ReplicationProtectionIntent(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The custom data. - :type properties: + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The custom data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ReplicationProtectionIntentProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ReplicationProtectionIntentProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["ReplicationProtectionIntentProperties"] = None, + properties: Optional["_models.ReplicationProtectionIntentProperties"] = None, **kwargs ): - super(ReplicationProtectionIntent, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The custom data. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class ReplicationProtectionIntentCollection(msrest.serialization.Model): +class ReplicationProtectionIntentCollection(_serialization.Model): """Replication protection intent objects collection. - :param value: The Replication protection intent details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The Replication protection intent details. + :vartype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ReplicationProtectionIntent]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ReplicationProtectionIntent]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["ReplicationProtectionIntent"]] = None, + value: Optional[List["_models.ReplicationProtectionIntent"]] = None, next_link: Optional[str] = None, **kwargs ): - super(ReplicationProtectionIntentCollection, self).__init__(**kwargs) + """ + :keyword value: The Replication protection intent details. + :paramtype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class ReplicationProtectionIntentProperties(msrest.serialization.Model): +class ReplicationProtectionIntentProperties(_serialization.Model): """Replication protection intent custom data details. Variables are only populated by the server, and will be ignored when sending a request. - :param friendly_name: The name. - :type friendly_name: str + :ivar friendly_name: The name. + :vartype friendly_name: str :ivar job_id: The job Id. :vartype job_id: str :ivar job_state: The job state. @@ -18494,35 +23190,45 @@ class ReplicationProtectionIntentProperties(msrest.serialization.Model): :vartype is_active: bool :ivar creation_time_utc: The creation time in UTC. :vartype creation_time_utc: str - :param provider_specific_details: The Replication provider custom settings. - :type provider_specific_details: + :ivar provider_specific_details: The Replication provider custom settings. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings """ _validation = { - 'job_id': {'readonly': True}, - 'job_state': {'readonly': True}, - 'is_active': {'readonly': True}, - 'creation_time_utc': {'readonly': True}, + "job_id": {"readonly": True}, + "job_state": {"readonly": True}, + "is_active": {"readonly": True}, + "creation_time_utc": {"readonly": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'job_state': {'key': 'jobState', 'type': 'str'}, - 'is_active': {'key': 'isActive', 'type': 'bool'}, - 'creation_time_utc': {'key': 'creationTimeUTC', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ReplicationProtectionIntentProviderSpecificSettings'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "job_state": {"key": "jobState", "type": "str"}, + "is_active": {"key": "isActive", "type": "bool"}, + "creation_time_utc": {"key": "creationTimeUTC", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "ReplicationProtectionIntentProviderSpecificSettings", + }, } def __init__( self, *, friendly_name: Optional[str] = None, - provider_specific_details: Optional["ReplicationProtectionIntentProviderSpecificSettings"] = None, + provider_specific_details: Optional["_models.ReplicationProtectionIntentProviderSpecificSettings"] = None, **kwargs ): - super(ReplicationProtectionIntentProperties, self).__init__(**kwargs) + """ + :keyword friendly_name: The name. + :paramtype friendly_name: str + :keyword provider_specific_details: The Replication provider custom settings. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.job_id = None self.job_state = None @@ -18531,28 +23237,27 @@ def __init__( self.provider_specific_details = provider_specific_details -class ReplicationProviderContainerUnmappingInput(msrest.serialization.Model): +class ReplicationProviderContainerUnmappingInput(_serialization.Model): """Provider specific input for unpairing operations. - :param instance_type: The class type. - :type instance_type: str + :ivar instance_type: The class type. + :vartype instance_type: str """ _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - *, - instance_type: Optional[str] = None, - **kwargs - ): - super(ReplicationProviderContainerUnmappingInput, self).__init__(**kwargs) + def __init__(self, *, instance_type: Optional[str] = None, **kwargs): + """ + :keyword instance_type: The class type. + :paramtype instance_type: str + """ + super().__init__(**kwargs) self.instance_type = instance_type -class ReprotectAgentDetails(msrest.serialization.Model): +class ReprotectAgentDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """Reprotect agent details. Variables are only populated by the server, and will be ignored when sending a request. @@ -18571,8 +23276,8 @@ class ReprotectAgentDetails(msrest.serialization.Model): :vartype version: str :ivar last_heartbeat_utc: The last heartbeat received from the reprotect agent. :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the reprotect agent. Possible values include: "None", "Normal", - "Warning", "Critical". + :ivar health: The health of the reprotect agent. Known values are: "None", "Normal", "Warning", + and "Critical". :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth :ivar health_errors: The health errors. :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] @@ -18587,42 +23292,40 @@ class ReprotectAgentDetails(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'bios_id': {'readonly': True}, - 'fabric_object_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'version': {'readonly': True}, - 'last_heartbeat_utc': {'readonly': True}, - 'health': {'readonly': True}, - 'health_errors': {'readonly': True}, - 'protected_item_count': {'readonly': True}, - 'accessible_datastores': {'readonly': True}, - 'vcenter_id': {'readonly': True}, - 'last_discovery_in_utc': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'bios_id': {'key': 'biosId', 'type': 'str'}, - 'fabric_object_id': {'key': 'fabricObjectId', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'last_heartbeat_utc': {'key': 'lastHeartbeatUtc', 'type': 'iso-8601'}, - 'health': {'key': 'health', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'int'}, - 'accessible_datastores': {'key': 'accessibleDatastores', 'type': '[str]'}, - 'vcenter_id': {'key': 'vcenterId', 'type': 'str'}, - 'last_discovery_in_utc': {'key': 'lastDiscoveryInUtc', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ReprotectAgentDetails, self).__init__(**kwargs) + "id": {"readonly": True}, + "name": {"readonly": True}, + "bios_id": {"readonly": True}, + "fabric_object_id": {"readonly": True}, + "fqdn": {"readonly": True}, + "version": {"readonly": True}, + "last_heartbeat_utc": {"readonly": True}, + "health": {"readonly": True}, + "health_errors": {"readonly": True}, + "protected_item_count": {"readonly": True}, + "accessible_datastores": {"readonly": True}, + "vcenter_id": {"readonly": True}, + "last_discovery_in_utc": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "bios_id": {"key": "biosId", "type": "str"}, + "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "health": {"key": "health", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, + "protected_item_count": {"key": "protectedItemCount", "type": "int"}, + "accessible_datastores": {"key": "accessibleDatastores", "type": "[str]"}, + "vcenter_id": {"key": "vcenterId", "type": "str"}, + "last_discovery_in_utc": {"key": "lastDiscoveryInUtc", "type": "iso-8601"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.bios_id = None @@ -18638,247 +23341,338 @@ def __init__( self.last_discovery_in_utc = None -class ResolveHealthError(msrest.serialization.Model): +class ResolveHealthError(_serialization.Model): """Resolve health errors input properties. - :param health_error_id: Health error id. - :type health_error_id: str + :ivar health_error_id: Health error id. + :vartype health_error_id: str """ _attribute_map = { - 'health_error_id': {'key': 'healthErrorId', 'type': 'str'}, + "health_error_id": {"key": "healthErrorId", "type": "str"}, } - def __init__( - self, - *, - health_error_id: Optional[str] = None, - **kwargs - ): - super(ResolveHealthError, self).__init__(**kwargs) + def __init__(self, *, health_error_id: Optional[str] = None, **kwargs): + """ + :keyword health_error_id: Health error id. + :paramtype health_error_id: str + """ + super().__init__(**kwargs) self.health_error_id = health_error_id -class ResolveHealthInput(msrest.serialization.Model): +class ResolveHealthInput(_serialization.Model): """Resolve health input. - :param properties: Disable resolve health input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInputProperties + :ivar properties: Disable resolve health input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ResolveHealthInputProperties'}, + "properties": {"key": "properties", "type": "ResolveHealthInputProperties"}, } - def __init__( - self, - *, - properties: Optional["ResolveHealthInputProperties"] = None, - **kwargs - ): - super(ResolveHealthInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.ResolveHealthInputProperties"] = None, **kwargs): + """ + :keyword properties: Disable resolve health input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class ResolveHealthInputProperties(msrest.serialization.Model): +class ResolveHealthInputProperties(_serialization.Model): """Resolve health input properties. - :param health_errors: Health errors. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthError] + :ivar health_errors: Health errors. + :vartype health_errors: + list[~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthError] """ _attribute_map = { - 'health_errors': {'key': 'healthErrors', 'type': '[ResolveHealthError]'}, + "health_errors": {"key": "healthErrors", "type": "[ResolveHealthError]"}, } - def __init__( - self, - *, - health_errors: Optional[List["ResolveHealthError"]] = None, - **kwargs - ): - super(ResolveHealthInputProperties, self).__init__(**kwargs) + def __init__(self, *, health_errors: Optional[List["_models.ResolveHealthError"]] = None, **kwargs): + """ + :keyword health_errors: Health errors. + :paramtype health_errors: + list[~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthError] + """ + super().__init__(**kwargs) self.health_errors = health_errors -class ResourceHealthSummary(msrest.serialization.Model): +class ResourceHealthSummary(_serialization.Model): """Base class to define the health summary of the resources contained under an Arm resource. - :param resource_count: The count of total resources under the container. - :type resource_count: int - :param issues: The list of summary of health errors across the resources under the container. - :type issues: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorSummary] - :param categorized_resource_counts: The categorized resource counts. - :type categorized_resource_counts: dict[str, int] + :ivar resource_count: The count of total resources under the container. + :vartype resource_count: int + :ivar issues: The list of summary of health errors across the resources under the container. + :vartype issues: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorSummary] + :ivar categorized_resource_counts: The categorized resource counts. + :vartype categorized_resource_counts: dict[str, int] """ _attribute_map = { - 'resource_count': {'key': 'resourceCount', 'type': 'int'}, - 'issues': {'key': 'issues', 'type': '[HealthErrorSummary]'}, - 'categorized_resource_counts': {'key': 'categorizedResourceCounts', 'type': '{int}'}, + "resource_count": {"key": "resourceCount", "type": "int"}, + "issues": {"key": "issues", "type": "[HealthErrorSummary]"}, + "categorized_resource_counts": {"key": "categorizedResourceCounts", "type": "{int}"}, } def __init__( self, *, resource_count: Optional[int] = None, - issues: Optional[List["HealthErrorSummary"]] = None, + issues: Optional[List["_models.HealthErrorSummary"]] = None, categorized_resource_counts: Optional[Dict[str, int]] = None, **kwargs ): - super(ResourceHealthSummary, self).__init__(**kwargs) + """ + :keyword resource_count: The count of total resources under the container. + :paramtype resource_count: int + :keyword issues: The list of summary of health errors across the resources under the container. + :paramtype issues: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorSummary] + :keyword categorized_resource_counts: The categorized resource counts. + :paramtype categorized_resource_counts: dict[str, int] + """ + super().__init__(**kwargs) self.resource_count = resource_count self.issues = issues self.categorized_resource_counts = categorized_resource_counts -class ResumeJobParams(msrest.serialization.Model): +class ResumeJobParams(_serialization.Model): """Resume job params. - :param properties: Resume job properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParamsProperties + :ivar properties: Resume job properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParamsProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ResumeJobParamsProperties'}, + "properties": {"key": "properties", "type": "ResumeJobParamsProperties"}, } - def __init__( - self, - *, - properties: Optional["ResumeJobParamsProperties"] = None, - **kwargs - ): - super(ResumeJobParams, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.ResumeJobParamsProperties"] = None, **kwargs): + """ + :keyword properties: Resume job properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParamsProperties + """ + super().__init__(**kwargs) self.properties = properties -class ResumeJobParamsProperties(msrest.serialization.Model): +class ResumeJobParamsProperties(_serialization.Model): """Resume job properties. - :param comments: Resume job comments. - :type comments: str + :ivar comments: Resume job comments. + :vartype comments: str """ _attribute_map = { - 'comments': {'key': 'comments', 'type': 'str'}, + "comments": {"key": "comments", "type": "str"}, } - def __init__( - self, - *, - comments: Optional[str] = None, - **kwargs - ): - super(ResumeJobParamsProperties, self).__init__(**kwargs) + def __init__(self, *, comments: Optional[str] = None, **kwargs): + """ + :keyword comments: Resume job comments. + :paramtype comments: str + """ + super().__init__(**kwargs) self.comments = comments -class ResyncInput(msrest.serialization.Model): +class ResumeReplicationInput(_serialization.Model): + """Resume replication input. + + All required parameters must be populated in order to send to Azure. + + :ivar properties: Resume replication input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInputProperties + """ + + _validation = { + "properties": {"required": True}, + } + + _attribute_map = { + "properties": {"key": "properties", "type": "ResumeReplicationInputProperties"}, + } + + def __init__(self, *, properties: "_models.ResumeReplicationInputProperties", **kwargs): + """ + :keyword properties: Resume replication input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInputProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ResumeReplicationInputProperties(_serialization.Model): + """Resume replication input properties. + + All required parameters must be populated in order to send to Azure. + + :ivar provider_specific_details: The provider specific input for resume replication. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationProviderSpecificInput + """ + + _validation = { + "provider_specific_details": {"required": True}, + } + + _attribute_map = { + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "ResumeReplicationProviderSpecificInput", + }, + } + + def __init__(self, *, provider_specific_details: "_models.ResumeReplicationProviderSpecificInput", **kwargs): + """ + :keyword provider_specific_details: The provider specific input for resume replication. + Required. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationProviderSpecificInput + """ + super().__init__(**kwargs) + self.provider_specific_details = provider_specific_details + + +class ResumeReplicationProviderSpecificInput(_serialization.Model): + """Resume replication provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtResumeReplicationInput + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: The class type. Required. + :vartype instance_type: str + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + } + + _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtResumeReplicationInput"}} + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = None # type: Optional[str] + + +class ResyncInput(_serialization.Model): """Resync input. All required parameters must be populated in order to send to Azure. - :param properties: Required. Resync input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInputProperties + :ivar properties: Resync input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ResyncInputProperties'}, + "properties": {"key": "properties", "type": "ResyncInputProperties"}, } - def __init__( - self, - *, - properties: "ResyncInputProperties", - **kwargs - ): - super(ResyncInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.ResyncInputProperties", **kwargs): + """ + :keyword properties: Resync input properties. Required. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class ResyncInputProperties(msrest.serialization.Model): +class ResyncInputProperties(_serialization.Model): """Resync input properties. All required parameters must be populated in order to send to Azure. - :param provider_specific_details: Required. The provider specific details. - :type provider_specific_details: + :ivar provider_specific_details: The provider specific details. Required. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncProviderSpecificInput """ _validation = { - 'provider_specific_details': {'required': True}, + "provider_specific_details": {"required": True}, } _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ResyncProviderSpecificInput'}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "ResyncProviderSpecificInput"}, } - def __init__( - self, - *, - provider_specific_details: "ResyncProviderSpecificInput", - **kwargs - ): - super(ResyncInputProperties, self).__init__(**kwargs) + def __init__(self, *, provider_specific_details: "_models.ResyncProviderSpecificInput", **kwargs): + """ + :keyword provider_specific_details: The provider specific details. Required. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ResyncProviderSpecificInput + """ + super().__init__(**kwargs) self.provider_specific_details = provider_specific_details -class ResyncProviderSpecificInput(msrest.serialization.Model): +class ResyncProviderSpecificInput(_serialization.Model): """Resync provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtResyncInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtResyncInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtResyncInput'} - } + _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtResyncInput"}} - def __init__( - self, - **kwargs - ): - super(ResyncProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class RetentionVolume(msrest.serialization.Model): +class RetentionVolume(_serialization.Model): """The retention details of the MT. - :param volume_name: The volume name. - :type volume_name: str - :param capacity_in_bytes: The volume capacity. - :type capacity_in_bytes: long - :param free_space_in_bytes: The free space available in this volume. - :type free_space_in_bytes: long - :param threshold_percentage: The threshold percentage. - :type threshold_percentage: int + :ivar volume_name: The volume name. + :vartype volume_name: str + :ivar capacity_in_bytes: The volume capacity. + :vartype capacity_in_bytes: int + :ivar free_space_in_bytes: The free space available in this volume. + :vartype free_space_in_bytes: int + :ivar threshold_percentage: The threshold percentage. + :vartype threshold_percentage: int """ _attribute_map = { - 'volume_name': {'key': 'volumeName', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'free_space_in_bytes': {'key': 'freeSpaceInBytes', 'type': 'long'}, - 'threshold_percentage': {'key': 'thresholdPercentage', 'type': 'int'}, + "volume_name": {"key": "volumeName", "type": "str"}, + "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, + "free_space_in_bytes": {"key": "freeSpaceInBytes", "type": "int"}, + "threshold_percentage": {"key": "thresholdPercentage", "type": "int"}, } def __init__( @@ -18890,96 +23684,128 @@ def __init__( threshold_percentage: Optional[int] = None, **kwargs ): - super(RetentionVolume, self).__init__(**kwargs) + """ + :keyword volume_name: The volume name. + :paramtype volume_name: str + :keyword capacity_in_bytes: The volume capacity. + :paramtype capacity_in_bytes: int + :keyword free_space_in_bytes: The free space available in this volume. + :paramtype free_space_in_bytes: int + :keyword threshold_percentage: The threshold percentage. + :paramtype threshold_percentage: int + """ + super().__init__(**kwargs) self.volume_name = volume_name self.capacity_in_bytes = capacity_in_bytes self.free_space_in_bytes = free_space_in_bytes self.threshold_percentage = threshold_percentage -class ReverseReplicationInput(msrest.serialization.Model): +class ReverseReplicationInput(_serialization.Model): """Reverse replication input. - :param properties: Reverse replication properties. - :type properties: + :ivar properties: Reverse replication properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ReverseReplicationInputProperties'}, + "properties": {"key": "properties", "type": "ReverseReplicationInputProperties"}, } - def __init__( - self, - *, - properties: Optional["ReverseReplicationInputProperties"] = None, - **kwargs - ): - super(ReverseReplicationInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.ReverseReplicationInputProperties"] = None, **kwargs): + """ + :keyword properties: Reverse replication properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class ReverseReplicationInputProperties(msrest.serialization.Model): +class ReverseReplicationInputProperties(_serialization.Model): """Reverse replication input properties. - :param failover_direction: Failover direction. - :type failover_direction: str - :param provider_specific_details: Provider specific reverse replication input. - :type provider_specific_details: + :ivar failover_direction: Failover direction. + :vartype failover_direction: str + :ivar provider_specific_details: Provider specific reverse replication input. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput """ _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'ReverseReplicationProviderSpecificInput'}, + "failover_direction": {"key": "failoverDirection", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "ReverseReplicationProviderSpecificInput", + }, } def __init__( self, *, failover_direction: Optional[str] = None, - provider_specific_details: Optional["ReverseReplicationProviderSpecificInput"] = None, + provider_specific_details: Optional["_models.ReverseReplicationProviderSpecificInput"] = None, **kwargs ): - super(ReverseReplicationInputProperties, self).__init__(**kwargs) + """ + :keyword failover_direction: Failover direction. + :paramtype failover_direction: str + :keyword provider_specific_details: Provider specific reverse replication input. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput + """ + super().__init__(**kwargs) self.failover_direction = failover_direction self.provider_specific_details = provider_specific_details -class RoleAssignment(msrest.serialization.Model): +class RoleAssignment(_serialization.Model): """Azure role assignment details. - :param id: The ARM Id of the role assignment. - :type id: str - :param name: The name of the role assignment. - :type name: str - :param scope: Role assignment scope. - :type scope: str - :param principal_id: Principal Id. - :type principal_id: str - :param role_definition_id: Role definition id. - :type role_definition_id: str + :ivar id: The ARM Id of the role assignment. + :vartype id: str + :ivar name: The name of the role assignment. + :vartype name: str + :ivar scope: Role assignment scope. + :vartype scope: str + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar role_definition_id: Role definition id. + :vartype role_definition_id: str """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "scope": {"key": "scope", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, scope: Optional[str] = None, principal_id: Optional[str] = None, role_definition_id: Optional[str] = None, **kwargs ): - super(RoleAssignment, self).__init__(**kwargs) + """ + :keyword id: The ARM Id of the role assignment. + :paramtype id: str + :keyword name: The name of the role assignment. + :paramtype name: str + :keyword scope: Role assignment scope. + :paramtype scope: str + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword role_definition_id: Role definition id. + :paramtype role_definition_id: str + """ + super().__init__(**kwargs) self.id = id self.name = name self.scope = scope @@ -18987,28 +23813,28 @@ def __init__( self.role_definition_id = role_definition_id -class RunAsAccount(msrest.serialization.Model): +class RunAsAccount(_serialization.Model): """CS Accounts Details. - :param account_id: The CS RunAs account Id. - :type account_id: str - :param account_name: The CS RunAs account name. - :type account_name: str + :ivar account_id: The CS RunAs account Id. + :vartype account_id: str + :ivar account_name: The CS RunAs account name. + :vartype account_name: str """ _attribute_map = { - 'account_id': {'key': 'accountId', 'type': 'str'}, - 'account_name': {'key': 'accountName', 'type': 'str'}, + "account_id": {"key": "accountId", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, } - def __init__( - self, - *, - account_id: Optional[str] = None, - account_name: Optional[str] = None, - **kwargs - ): - super(RunAsAccount, self).__init__(**kwargs) + def __init__(self, *, account_id: Optional[str] = None, account_name: Optional[str] = None, **kwargs): + """ + :keyword account_id: The CS RunAs account Id. + :paramtype account_id: str + :keyword account_name: The CS RunAs account name. + :paramtype account_name: str + """ + super().__init__(**kwargs) self.account_id = account_id self.account_name = account_name @@ -19018,28 +23844,28 @@ class ScriptActionTaskDetails(TaskTypeDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param name: The name. - :type name: str - :param path: The path. - :type path: str - :param output: The output. - :type output: str - :param is_primary_side_script: A value indicating whether it is a primary side script or not. - :type is_primary_side_script: bool + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar name: The name. + :vartype name: str + :ivar path: The path. + :vartype path: str + :ivar output: The output. + :vartype output: str + :ivar is_primary_side_script: A value indicating whether it is a primary side script or not. + :vartype is_primary_side_script: bool """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, - 'output': {'key': 'output', 'type': 'str'}, - 'is_primary_side_script': {'key': 'isPrimarySideScript', 'type': 'bool'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "output": {"key": "output", "type": "str"}, + "is_primary_side_script": {"key": "isPrimarySideScript", "type": "bool"}, } def __init__( @@ -19051,35 +23877,45 @@ def __init__( is_primary_side_script: Optional[bool] = None, **kwargs ): - super(ScriptActionTaskDetails, self).__init__(**kwargs) - self.instance_type = 'ScriptActionTaskDetails' # type: str + """ + :keyword name: The name. + :paramtype name: str + :keyword path: The path. + :paramtype path: str + :keyword output: The output. + :paramtype output: str + :keyword is_primary_side_script: A value indicating whether it is a primary side script or not. + :paramtype is_primary_side_script: bool + """ + super().__init__(**kwargs) + self.instance_type = "ScriptActionTaskDetails" # type: str self.name = name self.path = path self.output = output self.is_primary_side_script = is_primary_side_script -class ServiceError(msrest.serialization.Model): +class ServiceError(_serialization.Model): """ASR error model. - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str - :param possible_causes: Possible causes of error. - :type possible_causes: str - :param recommended_action: Recommended action to resolve error. - :type recommended_action: str - :param activity_id: Activity Id. - :type activity_id: str + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar possible_causes: Possible causes of error. + :vartype possible_causes: str + :ivar recommended_action: Recommended action to resolve error. + :vartype recommended_action: str + :ivar activity_id: Activity Id. + :vartype activity_id: str """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'possible_causes': {'key': 'possibleCauses', 'type': 'str'}, - 'recommended_action': {'key': 'recommendedAction', 'type': 'str'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "activity_id": {"key": "activityId", "type": "str"}, } def __init__( @@ -19092,7 +23928,19 @@ def __init__( activity_id: Optional[str] = None, **kwargs ): - super(ServiceError, self).__init__(**kwargs) + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message. + :paramtype message: str + :keyword possible_causes: Possible causes of error. + :paramtype possible_causes: str + :keyword recommended_action: Recommended action to resolve error. + :paramtype recommended_action: str + :keyword activity_id: Activity Id. + :paramtype activity_id: str + """ + super().__init__(**kwargs) self.code = code self.message = message self.possible_causes = possible_causes @@ -19111,60 +23959,73 @@ class StorageClassification(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Properties of the storage object. - :type properties: + :ivar location: Resource Location. + :vartype location: str + :ivar properties: Properties of the storage object. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'StorageClassificationProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "StorageClassificationProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["StorageClassificationProperties"] = None, + properties: Optional["_models.StorageClassificationProperties"] = None, **kwargs ): - super(StorageClassification, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: Properties of the storage object. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class StorageClassificationCollection(msrest.serialization.Model): +class StorageClassificationCollection(_serialization.Model): """Collection of storage details. - :param value: The storage details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The storage details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageClassification]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[StorageClassification]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["StorageClassification"]] = None, + value: Optional[List["_models.StorageClassification"]] = None, next_link: Optional[str] = None, **kwargs ): - super(StorageClassificationCollection, self).__init__(**kwargs) + """ + :keyword value: The storage details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -19180,163 +24041,176 @@ class StorageClassificationMapping(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: Properties of the storage mapping object. - :type properties: + :ivar location: Resource Location. + :vartype location: str + :ivar properties: Properties of the storage mapping object. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'StorageClassificationMappingProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "StorageClassificationMappingProperties"}, } def __init__( self, *, location: Optional[str] = None, - properties: Optional["StorageClassificationMappingProperties"] = None, + properties: Optional["_models.StorageClassificationMappingProperties"] = None, **kwargs ): - super(StorageClassificationMapping, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: Properties of the storage mapping object. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class StorageClassificationMappingCollection(msrest.serialization.Model): +class StorageClassificationMappingCollection(_serialization.Model): """Collection of storage mapping details. - :param value: The storage details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The storage details. + :vartype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageClassificationMapping]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[StorageClassificationMapping]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["StorageClassificationMapping"]] = None, + value: Optional[List["_models.StorageClassificationMapping"]] = None, next_link: Optional[str] = None, **kwargs ): - super(StorageClassificationMappingCollection, self).__init__(**kwargs) + """ + :keyword value: The storage details. + :paramtype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class StorageClassificationMappingInput(msrest.serialization.Model): +class StorageClassificationMappingInput(_serialization.Model): """Storage mapping input. - :param properties: Storage mapping input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.StorageMappingInputProperties + :ivar properties: Storage mapping input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageMappingInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'StorageMappingInputProperties'}, + "properties": {"key": "properties", "type": "StorageMappingInputProperties"}, } - def __init__( - self, - *, - properties: Optional["StorageMappingInputProperties"] = None, - **kwargs - ): - super(StorageClassificationMappingInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.StorageMappingInputProperties"] = None, **kwargs): + """ + :keyword properties: Storage mapping input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageMappingInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class StorageClassificationMappingProperties(msrest.serialization.Model): +class StorageClassificationMappingProperties(_serialization.Model): """Storage mapping properties. - :param target_storage_classification_id: Target storage object Id. - :type target_storage_classification_id: str + :ivar target_storage_classification_id: Target storage object Id. + :vartype target_storage_classification_id: str """ _attribute_map = { - 'target_storage_classification_id': {'key': 'targetStorageClassificationId', 'type': 'str'}, + "target_storage_classification_id": {"key": "targetStorageClassificationId", "type": "str"}, } - def __init__( - self, - *, - target_storage_classification_id: Optional[str] = None, - **kwargs - ): - super(StorageClassificationMappingProperties, self).__init__(**kwargs) + def __init__(self, *, target_storage_classification_id: Optional[str] = None, **kwargs): + """ + :keyword target_storage_classification_id: Target storage object Id. + :paramtype target_storage_classification_id: str + """ + super().__init__(**kwargs) self.target_storage_classification_id = target_storage_classification_id -class StorageClassificationProperties(msrest.serialization.Model): +class StorageClassificationProperties(_serialization.Model): """Storage object properties. - :param friendly_name: Friendly name of the Storage classification. - :type friendly_name: str + :ivar friendly_name: Friendly name of the Storage classification. + :vartype friendly_name: str """ _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, } - def __init__( - self, - *, - friendly_name: Optional[str] = None, - **kwargs - ): - super(StorageClassificationProperties, self).__init__(**kwargs) + def __init__(self, *, friendly_name: Optional[str] = None, **kwargs): + """ + :keyword friendly_name: Friendly name of the Storage classification. + :paramtype friendly_name: str + """ + super().__init__(**kwargs) self.friendly_name = friendly_name -class StorageMappingInputProperties(msrest.serialization.Model): +class StorageMappingInputProperties(_serialization.Model): """Storage mapping input properties. - :param target_storage_classification_id: The ID of the storage object. - :type target_storage_classification_id: str + :ivar target_storage_classification_id: The ID of the storage object. + :vartype target_storage_classification_id: str """ _attribute_map = { - 'target_storage_classification_id': {'key': 'targetStorageClassificationId', 'type': 'str'}, + "target_storage_classification_id": {"key": "targetStorageClassificationId", "type": "str"}, } - def __init__( - self, - *, - target_storage_classification_id: Optional[str] = None, - **kwargs - ): - super(StorageMappingInputProperties, self).__init__(**kwargs) + def __init__(self, *, target_storage_classification_id: Optional[str] = None, **kwargs): + """ + :keyword target_storage_classification_id: The ID of the storage object. + :paramtype target_storage_classification_id: str + """ + super().__init__(**kwargs) self.target_storage_classification_id = target_storage_classification_id -class Subnet(msrest.serialization.Model): +class Subnet(_serialization.Model): """Subnets of the network. - :param name: The subnet name. - :type name: str - :param friendly_name: The subnet friendly name. - :type friendly_name: str - :param address_list: The list of addresses for the subnet. - :type address_list: list[str] + :ivar name: The subnet name. + :vartype name: str + :ivar friendly_name: The subnet friendly name. + :vartype friendly_name: str + :ivar address_list: The list of addresses for the subnet. + :vartype address_list: list[str] """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'address_list': {'key': 'addressList', 'type': '[str]'}, + "name": {"key": "name", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "address_list": {"key": "addressList", "type": "[str]"}, } def __init__( @@ -19347,7 +24221,15 @@ def __init__( address_list: Optional[List[str]] = None, **kwargs ): - super(Subnet, self).__init__(**kwargs) + """ + :keyword name: The subnet name. + :paramtype name: str + :keyword friendly_name: The subnet friendly name. + :paramtype friendly_name: str + :keyword address_list: The list of addresses for the subnet. + :paramtype address_list: list[str] + """ + super().__init__(**kwargs) self.name = name self.friendly_name = friendly_name self.address_list = address_list @@ -19364,52 +24246,54 @@ class SupportedOperatingSystems(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The supported operating systems properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The supported operating systems properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'SupportedOSProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "SupportedOSProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["SupportedOSProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.SupportedOSProperties"] = None, **kwargs ): - super(SupportedOperatingSystems, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The supported operating systems properties. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class SupportedOSDetails(msrest.serialization.Model): +class SupportedOSDetails(_serialization.Model): """Supported operating system details. - :param os_name: The name. - :type os_name: str - :param os_type: The type. - :type os_type: str - :param os_versions: The list of version for operating system. - :type os_versions: list[~azure.mgmt.recoveryservicessiterecovery.models.OSVersionWrapper] + :ivar os_name: The name. + :vartype os_name: str + :ivar os_type: The type. + :vartype os_type: str + :ivar os_versions: The list of version for operating system. + :vartype os_versions: list[~azure.mgmt.recoveryservicessiterecovery.models.OSVersionWrapper] """ _attribute_map = { - 'os_name': {'key': 'osName', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_versions': {'key': 'osVersions', 'type': '[OSVersionWrapper]'}, + "os_name": {"key": "osName", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "os_versions": {"key": "osVersions", "type": "[OSVersionWrapper]"}, } def __init__( @@ -19417,108 +24301,133 @@ def __init__( *, os_name: Optional[str] = None, os_type: Optional[str] = None, - os_versions: Optional[List["OSVersionWrapper"]] = None, - **kwargs - ): - super(SupportedOSDetails, self).__init__(**kwargs) + os_versions: Optional[List["_models.OSVersionWrapper"]] = None, + **kwargs + ): + """ + :keyword os_name: The name. + :paramtype os_name: str + :keyword os_type: The type. + :paramtype os_type: str + :keyword os_versions: The list of version for operating system. + :paramtype os_versions: list[~azure.mgmt.recoveryservicessiterecovery.models.OSVersionWrapper] + """ + super().__init__(**kwargs) self.os_name = os_name self.os_type = os_type self.os_versions = os_versions -class SupportedOSProperties(msrest.serialization.Model): +class SupportedOSProperties(_serialization.Model): """Supported operating systems properties. - :param supported_os_list: The supported operating systems property list. - :type supported_os_list: + :ivar supported_os_list: The supported operating systems property list. + :vartype supported_os_list: list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperty] """ _attribute_map = { - 'supported_os_list': {'key': 'supportedOsList', 'type': '[SupportedOSProperty]'}, + "supported_os_list": {"key": "supportedOsList", "type": "[SupportedOSProperty]"}, } - def __init__( - self, - *, - supported_os_list: Optional[List["SupportedOSProperty"]] = None, - **kwargs - ): - super(SupportedOSProperties, self).__init__(**kwargs) + def __init__(self, *, supported_os_list: Optional[List["_models.SupportedOSProperty"]] = None, **kwargs): + """ + :keyword supported_os_list: The supported operating systems property list. + :paramtype supported_os_list: + list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperty] + """ + super().__init__(**kwargs) self.supported_os_list = supported_os_list -class SupportedOSProperty(msrest.serialization.Model): +class SupportedOSProperty(_serialization.Model): """Supported operating systems property. - :param instance_type: The replication provider type. - :type instance_type: str - :param supported_os: The list of supported operating systems. - :type supported_os: list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSDetails] + :ivar instance_type: The replication provider type. + :vartype instance_type: str + :ivar supported_os: The list of supported operating systems. + :vartype supported_os: list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSDetails] """ _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'supported_os': {'key': 'supportedOs', 'type': '[SupportedOSDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "supported_os": {"key": "supportedOs", "type": "[SupportedOSDetails]"}, } def __init__( self, *, instance_type: Optional[str] = None, - supported_os: Optional[List["SupportedOSDetails"]] = None, + supported_os: Optional[List["_models.SupportedOSDetails"]] = None, **kwargs ): - super(SupportedOSProperty, self).__init__(**kwargs) + """ + :keyword instance_type: The replication provider type. + :paramtype instance_type: str + :keyword supported_os: The list of supported operating systems. + :paramtype supported_os: + list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSDetails] + """ + super().__init__(**kwargs) self.instance_type = instance_type self.supported_os = supported_os -class SwitchProtectionInput(msrest.serialization.Model): +class SwitchProtectionInput(_serialization.Model): """Switch protection input. - :param properties: Switch protection properties. - :type properties: + :ivar properties: Switch protection properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'SwitchProtectionInputProperties'}, + "properties": {"key": "properties", "type": "SwitchProtectionInputProperties"}, } - def __init__( - self, - *, - properties: Optional["SwitchProtectionInputProperties"] = None, - **kwargs - ): - super(SwitchProtectionInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.SwitchProtectionInputProperties"] = None, **kwargs): + """ + :keyword properties: Switch protection properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class SwitchProtectionInputProperties(msrest.serialization.Model): +class SwitchProtectionInputProperties(_serialization.Model): """Switch protection input properties. - :param replication_protected_item_name: The unique replication protected item name. - :type replication_protected_item_name: str - :param provider_specific_details: Provider specific switch protection input. - :type provider_specific_details: + :ivar replication_protected_item_name: The unique replication protected item name. + :vartype replication_protected_item_name: str + :ivar provider_specific_details: Provider specific switch protection input. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput """ _attribute_map = { - 'replication_protected_item_name': {'key': 'replicationProtectedItemName', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'SwitchProtectionProviderSpecificInput'}, + "replication_protected_item_name": {"key": "replicationProtectedItemName", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "SwitchProtectionProviderSpecificInput", + }, } def __init__( self, *, replication_protected_item_name: Optional[str] = None, - provider_specific_details: Optional["SwitchProtectionProviderSpecificInput"] = None, + provider_specific_details: Optional["_models.SwitchProtectionProviderSpecificInput"] = None, **kwargs ): - super(SwitchProtectionInputProperties, self).__init__(**kwargs) + """ + :keyword replication_protected_item_name: The unique replication protected item name. + :paramtype replication_protected_item_name: str + :keyword provider_specific_details: Provider specific switch protection input. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput + """ + super().__init__(**kwargs) self.replication_protected_item_name = replication_protected_item_name self.provider_specific_details = provider_specific_details @@ -19528,24 +24437,24 @@ class SwitchProtectionJobDetails(JobDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - :param new_replication_protected_item_id: ARM Id of the new replication protected item. - :type new_replication_protected_item_id: str + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. + :vartype instance_type: str + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar new_replication_protected_item_id: ARM Id of the new replication protected item. + :vartype new_replication_protected_item_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - 'new_replication_protected_item_id': {'key': 'newReplicationProtectedItemId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, + "new_replication_protected_item_id": {"key": "newReplicationProtectedItemId", "type": "str"}, } def __init__( @@ -19555,117 +24464,193 @@ def __init__( new_replication_protected_item_id: Optional[str] = None, **kwargs ): - super(SwitchProtectionJobDetails, self).__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type = 'SwitchProtectionJobDetails' # type: str + """ + :keyword affected_object_details: The affected object properties like source server, source + cloud, target server, target cloud etc. based on the workflow object details. + :paramtype affected_object_details: dict[str, str] + :keyword new_replication_protected_item_id: ARM Id of the new replication protected item. + :paramtype new_replication_protected_item_id: str + """ + super().__init__(affected_object_details=affected_object_details, **kwargs) + self.instance_type = "SwitchProtectionJobDetails" # type: str self.new_replication_protected_item_id = new_replication_protected_item_id -class TargetComputeSize(msrest.serialization.Model): +class SwitchProviderInput(_serialization.Model): + """Input definition for switch provider. + + :ivar properties: Switch provider input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInputProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "SwitchProviderInputProperties"}, + } + + def __init__(self, *, properties: Optional["_models.SwitchProviderInputProperties"] = None, **kwargs): + """ + :keyword properties: Switch provider input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInputProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SwitchProviderInputProperties(_serialization.Model): + """Input definition for switch provider input properties. + + :ivar target_instance_type: Target provider type. + :vartype target_instance_type: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderSpecificInput + """ + + _attribute_map = { + "target_instance_type": {"key": "targetInstanceType", "type": "str"}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "SwitchProviderSpecificInput"}, + } + + def __init__( + self, + *, + target_instance_type: Optional[str] = None, + provider_specific_details: Optional["_models.SwitchProviderSpecificInput"] = None, + **kwargs + ): + """ + :keyword target_instance_type: Target provider type. + :paramtype target_instance_type: str + :keyword provider_specific_details: Provider specific settings. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderSpecificInput + """ + super().__init__(**kwargs) + self.target_instance_type = target_instance_type + self.provider_specific_details = provider_specific_details + + +class TargetComputeSize(_serialization.Model): """Represents applicable recovery vm sizes. - :param id: The Id. - :type id: str - :param name: The name. - :type name: str - :param type: The Type of the object. - :type type: str - :param properties: The custom data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeProperties + :ivar id: The Id. + :vartype id: str + :ivar name: The name. + :vartype name: str + :ivar type: The Type of the object. + :vartype type: str + :ivar properties: The custom data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeProperties """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'TargetComputeSizeProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "TargetComputeSizeProperties"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, - properties: Optional["TargetComputeSizeProperties"] = None, - **kwargs - ): - super(TargetComputeSize, self).__init__(**kwargs) + properties: Optional["_models.TargetComputeSizeProperties"] = None, + **kwargs + ): + """ + :keyword id: The Id. + :paramtype id: str + :keyword name: The name. + :paramtype name: str + :keyword type: The Type of the object. + :paramtype type: str + :keyword properties: The custom data. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeProperties + """ + super().__init__(**kwargs) self.id = id self.name = name self.type = type self.properties = properties -class TargetComputeSizeCollection(msrest.serialization.Model): +class TargetComputeSizeCollection(_serialization.Model): """Target compute size collection. - :param value: The list of target compute sizes. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The list of target compute sizes. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[TargetComputeSize]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[TargetComputeSize]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["TargetComputeSize"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.TargetComputeSize"]] = None, next_link: Optional[str] = None, **kwargs ): - super(TargetComputeSizeCollection, self).__init__(**kwargs) + """ + :keyword value: The list of target compute sizes. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class TargetComputeSizeProperties(msrest.serialization.Model): +class TargetComputeSizeProperties(_serialization.Model): """Represents applicable recovery vm sizes properties. Variables are only populated by the server, and will be ignored when sending a request. - :param name: Target compute size name. - :type name: str - :param friendly_name: Target compute size display name. - :type friendly_name: str - :param cpu_cores_count: The maximum cpu cores count supported by target compute size. - :type cpu_cores_count: int + :ivar name: Target compute size name. + :vartype name: str + :ivar friendly_name: Target compute size display name. + :vartype friendly_name: str + :ivar cpu_cores_count: The maximum cpu cores count supported by target compute size. + :vartype cpu_cores_count: int :ivar v_cpus_available: The Available vCPUs supported by target compute size. :vartype v_cpus_available: int - :param memory_in_gb: The maximum memory in GB supported by target compute size. - :type memory_in_gb: float - :param max_data_disk_count: The maximum data disks count supported by target compute size. - :type max_data_disk_count: int - :param max_nics_count: The maximum Nics count supported by target compute size. - :type max_nics_count: int - :param errors: The reasons why the target compute size is not applicable for the protected - item. - :type errors: list[~azure.mgmt.recoveryservicessiterecovery.models.ComputeSizeErrorDetails] - :param high_iops_supported: The value indicating whether the target compute size supports high + :ivar memory_in_gb: The maximum memory in GB supported by target compute size. + :vartype memory_in_gb: float + :ivar max_data_disk_count: The maximum data disks count supported by target compute size. + :vartype max_data_disk_count: int + :ivar max_nics_count: The maximum Nics count supported by target compute size. + :vartype max_nics_count: int + :ivar errors: The reasons why the target compute size is not applicable for the protected item. + :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.ComputeSizeErrorDetails] + :ivar high_iops_supported: The value indicating whether the target compute size supports high Iops. - :type high_iops_supported: str - :param hyper_v_generations: The supported HyperV Generations. - :type hyper_v_generations: list[str] + :vartype high_iops_supported: str + :ivar hyper_v_generations: The supported HyperV Generations. + :vartype hyper_v_generations: list[str] """ _validation = { - 'v_cpus_available': {'readonly': True}, + "v_cpus_available": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'cpu_cores_count': {'key': 'cpuCoresCount', 'type': 'int'}, - 'v_cpus_available': {'key': 'vCPUsAvailable', 'type': 'int'}, - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'float'}, - 'max_data_disk_count': {'key': 'maxDataDiskCount', 'type': 'int'}, - 'max_nics_count': {'key': 'maxNicsCount', 'type': 'int'}, - 'errors': {'key': 'errors', 'type': '[ComputeSizeErrorDetails]'}, - 'high_iops_supported': {'key': 'highIopsSupported', 'type': 'str'}, - 'hyper_v_generations': {'key': 'hyperVGenerations', 'type': '[str]'}, + "name": {"key": "name", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "cpu_cores_count": {"key": "cpuCoresCount", "type": "int"}, + "v_cpus_available": {"key": "vCPUsAvailable", "type": "int"}, + "memory_in_gb": {"key": "memoryInGB", "type": "float"}, + "max_data_disk_count": {"key": "maxDataDiskCount", "type": "int"}, + "max_nics_count": {"key": "maxNicsCount", "type": "int"}, + "errors": {"key": "errors", "type": "[ComputeSizeErrorDetails]"}, + "high_iops_supported": {"key": "highIopsSupported", "type": "str"}, + "hyper_v_generations": {"key": "hyperVGenerations", "type": "[str]"}, } def __init__( @@ -19677,12 +24662,35 @@ def __init__( memory_in_gb: Optional[float] = None, max_data_disk_count: Optional[int] = None, max_nics_count: Optional[int] = None, - errors: Optional[List["ComputeSizeErrorDetails"]] = None, + errors: Optional[List["_models.ComputeSizeErrorDetails"]] = None, high_iops_supported: Optional[str] = None, hyper_v_generations: Optional[List[str]] = None, **kwargs ): - super(TargetComputeSizeProperties, self).__init__(**kwargs) + """ + :keyword name: Target compute size name. + :paramtype name: str + :keyword friendly_name: Target compute size display name. + :paramtype friendly_name: str + :keyword cpu_cores_count: The maximum cpu cores count supported by target compute size. + :paramtype cpu_cores_count: int + :keyword memory_in_gb: The maximum memory in GB supported by target compute size. + :paramtype memory_in_gb: float + :keyword max_data_disk_count: The maximum data disks count supported by target compute size. + :paramtype max_data_disk_count: int + :keyword max_nics_count: The maximum Nics count supported by target compute size. + :paramtype max_nics_count: int + :keyword errors: The reasons why the target compute size is not applicable for the protected + item. + :paramtype errors: + list[~azure.mgmt.recoveryservicessiterecovery.models.ComputeSizeErrorDetails] + :keyword high_iops_supported: The value indicating whether the target compute size supports + high Iops. + :paramtype high_iops_supported: str + :keyword hyper_v_generations: The supported HyperV Generations. + :paramtype hyper_v_generations: list[str] + """ + super().__init__(**kwargs) self.name = name self.friendly_name = friendly_name self.cpu_cores_count = cpu_cores_count @@ -19695,105 +24703,105 @@ def __init__( self.hyper_v_generations = hyper_v_generations -class TestFailoverCleanupInput(msrest.serialization.Model): +class TestFailoverCleanupInput(_serialization.Model): """Input definition for test failover cleanup. All required parameters must be populated in order to send to Azure. - :param properties: Required. Test failover cleanup input properties. - :type properties: + :ivar properties: Test failover cleanup input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'TestFailoverCleanupInputProperties'}, + "properties": {"key": "properties", "type": "TestFailoverCleanupInputProperties"}, } - def __init__( - self, - *, - properties: "TestFailoverCleanupInputProperties", - **kwargs - ): - super(TestFailoverCleanupInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.TestFailoverCleanupInputProperties", **kwargs): + """ + :keyword properties: Test failover cleanup input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class TestFailoverCleanupInputProperties(msrest.serialization.Model): +class TestFailoverCleanupInputProperties(_serialization.Model): """Input definition for test failover cleanup input properties. - :param comments: Test failover cleanup comments. - :type comments: str + :ivar comments: Test failover cleanup comments. + :vartype comments: str """ _validation = { - 'comments': {'max_length': 1024, 'min_length': 0}, + "comments": {"max_length": 1024}, } _attribute_map = { - 'comments': {'key': 'comments', 'type': 'str'}, + "comments": {"key": "comments", "type": "str"}, } - def __init__( - self, - *, - comments: Optional[str] = None, - **kwargs - ): - super(TestFailoverCleanupInputProperties, self).__init__(**kwargs) + def __init__(self, *, comments: Optional[str] = None, **kwargs): + """ + :keyword comments: Test failover cleanup comments. + :paramtype comments: str + """ + super().__init__(**kwargs) self.comments = comments -class TestFailoverInput(msrest.serialization.Model): +class TestFailoverInput(_serialization.Model): """Input definition for test failover. All required parameters must be populated in order to send to Azure. - :param properties: Required. Test failover input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInputProperties + :ivar properties: Test failover input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'TestFailoverInputProperties'}, + "properties": {"key": "properties", "type": "TestFailoverInputProperties"}, } - def __init__( - self, - *, - properties: "TestFailoverInputProperties", - **kwargs - ): - super(TestFailoverInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.TestFailoverInputProperties", **kwargs): + """ + :keyword properties: Test failover input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class TestFailoverInputProperties(msrest.serialization.Model): +class TestFailoverInputProperties(_serialization.Model): """Input definition for test failover input properties. - :param failover_direction: Test failover direction. - :type failover_direction: str - :param network_type: Network type to be used for test failover. - :type network_type: str - :param network_id: The id of the network to be used for test failover. - :type network_id: str - :param provider_specific_details: Provider specific settings. - :type provider_specific_details: + :ivar failover_direction: Test failover direction. + :vartype failover_direction: str + :ivar network_type: Network type to be used for test failover. + :vartype network_type: str + :ivar network_id: The id of the network to be used for test failover. + :vartype network_id: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput """ _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'network_type': {'key': 'networkType', 'type': 'str'}, - 'network_id': {'key': 'networkId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'TestFailoverProviderSpecificInput'}, + "failover_direction": {"key": "failoverDirection", "type": "str"}, + "network_type": {"key": "networkType", "type": "str"}, + "network_id": {"key": "networkId", "type": "str"}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "TestFailoverProviderSpecificInput"}, } def __init__( @@ -19802,10 +24810,21 @@ def __init__( failover_direction: Optional[str] = None, network_type: Optional[str] = None, network_id: Optional[str] = None, - provider_specific_details: Optional["TestFailoverProviderSpecificInput"] = None, - **kwargs - ): - super(TestFailoverInputProperties, self).__init__(**kwargs) + provider_specific_details: Optional["_models.TestFailoverProviderSpecificInput"] = None, + **kwargs + ): + """ + :keyword failover_direction: Test failover direction. + :paramtype failover_direction: str + :keyword network_type: Network type to be used for test failover. + :paramtype network_type: str + :keyword network_id: The id of the network to be used for test failover. + :paramtype network_id: str + :keyword provider_specific_details: Provider specific settings. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput + """ + super().__init__(**kwargs) self.failover_direction = failover_direction self.network_type = network_type self.network_id = network_id @@ -19817,40 +24836,40 @@ class TestFailoverJobDetails(JobDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the type of job details (see JobDetailsTypes enum for - possible values).Constant filled by server. - :type instance_type: str - :param affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :type affected_object_details: dict[str, str] - :param test_failover_status: The test failover status. - :type test_failover_status: str - :param comments: The test failover comments. - :type comments: str - :param network_name: The test network name. - :type network_name: str - :param network_friendly_name: The test network friendly name. - :type network_friendly_name: str - :param network_type: The test network type (see TestFailoverInput enum for possible values). - :type network_type: str - :param protected_item_details: The test VM details. - :type protected_item_details: + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. + :vartype instance_type: str + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar test_failover_status: The test failover status. + :vartype test_failover_status: str + :ivar comments: The test failover comments. + :vartype comments: str + :ivar network_name: The test network name. + :vartype network_name: str + :ivar network_friendly_name: The test network friendly name. + :vartype network_friendly_name: str + :ivar network_type: The test network type (see TestFailoverInput enum for possible values). + :vartype network_type: str + :ivar protected_item_details: The test VM details. + :vartype protected_item_details: list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'affected_object_details': {'key': 'affectedObjectDetails', 'type': '{str}'}, - 'test_failover_status': {'key': 'testFailoverStatus', 'type': 'str'}, - 'comments': {'key': 'comments', 'type': 'str'}, - 'network_name': {'key': 'networkName', 'type': 'str'}, - 'network_friendly_name': {'key': 'networkFriendlyName', 'type': 'str'}, - 'network_type': {'key': 'networkType', 'type': 'str'}, - 'protected_item_details': {'key': 'protectedItemDetails', 'type': '[FailoverReplicationProtectedItemDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, + "test_failover_status": {"key": "testFailoverStatus", "type": "str"}, + "comments": {"key": "comments", "type": "str"}, + "network_name": {"key": "networkName", "type": "str"}, + "network_friendly_name": {"key": "networkFriendlyName", "type": "str"}, + "network_type": {"key": "networkType", "type": "str"}, + "protected_item_details": {"key": "protectedItemDetails", "type": "[FailoverReplicationProtectedItemDetails]"}, } def __init__( @@ -19862,11 +24881,29 @@ def __init__( network_name: Optional[str] = None, network_friendly_name: Optional[str] = None, network_type: Optional[str] = None, - protected_item_details: Optional[List["FailoverReplicationProtectedItemDetails"]] = None, - **kwargs - ): - super(TestFailoverJobDetails, self).__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type = 'TestFailoverJobDetails' # type: str + protected_item_details: Optional[List["_models.FailoverReplicationProtectedItemDetails"]] = None, + **kwargs + ): + """ + :keyword affected_object_details: The affected object properties like source server, source + cloud, target server, target cloud etc. based on the workflow object details. + :paramtype affected_object_details: dict[str, str] + :keyword test_failover_status: The test failover status. + :paramtype test_failover_status: str + :keyword comments: The test failover comments. + :paramtype comments: str + :keyword network_name: The test network name. + :paramtype network_name: str + :keyword network_friendly_name: The test network friendly name. + :paramtype network_friendly_name: str + :keyword network_type: The test network type (see TestFailoverInput enum for possible values). + :paramtype network_type: str + :keyword protected_item_details: The test VM details. + :paramtype protected_item_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] + """ + super().__init__(affected_object_details=affected_object_details, **kwargs) + self.instance_type = "TestFailoverJobDetails" # type: str self.test_failover_status = test_failover_status self.comments = comments self.network_name = network_name @@ -19875,190 +24912,188 @@ def __init__( self.protected_item_details = protected_item_details -class TestMigrateCleanupInput(msrest.serialization.Model): +class TestMigrateCleanupInput(_serialization.Model): """Input for test migrate cleanup. All required parameters must be populated in order to send to Azure. - :param properties: Required. Test migrate cleanup input properties. - :type properties: + :ivar properties: Test migrate cleanup input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'TestMigrateCleanupInputProperties'}, + "properties": {"key": "properties", "type": "TestMigrateCleanupInputProperties"}, } - def __init__( - self, - *, - properties: "TestMigrateCleanupInputProperties", - **kwargs - ): - super(TestMigrateCleanupInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.TestMigrateCleanupInputProperties", **kwargs): + """ + :keyword properties: Test migrate cleanup input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class TestMigrateCleanupInputProperties(msrest.serialization.Model): +class TestMigrateCleanupInputProperties(_serialization.Model): """Test migrate cleanup input properties. - :param comments: Test migrate cleanup comments. - :type comments: str + :ivar comments: Test migrate cleanup comments. + :vartype comments: str """ _validation = { - 'comments': {'max_length': 1024, 'min_length': 0}, + "comments": {"max_length": 1024}, } _attribute_map = { - 'comments': {'key': 'comments', 'type': 'str'}, + "comments": {"key": "comments", "type": "str"}, } - def __init__( - self, - *, - comments: Optional[str] = None, - **kwargs - ): - super(TestMigrateCleanupInputProperties, self).__init__(**kwargs) + def __init__(self, *, comments: Optional[str] = None, **kwargs): + """ + :keyword comments: Test migrate cleanup comments. + :paramtype comments: str + """ + super().__init__(**kwargs) self.comments = comments -class TestMigrateInput(msrest.serialization.Model): +class TestMigrateInput(_serialization.Model): """Input for test migrate. All required parameters must be populated in order to send to Azure. - :param properties: Required. Test migrate input properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInputProperties + :ivar properties: Test migrate input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'TestMigrateInputProperties'}, + "properties": {"key": "properties", "type": "TestMigrateInputProperties"}, } - def __init__( - self, - *, - properties: "TestMigrateInputProperties", - **kwargs - ): - super(TestMigrateInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.TestMigrateInputProperties", **kwargs): + """ + :keyword properties: Test migrate input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class TestMigrateInputProperties(msrest.serialization.Model): +class TestMigrateInputProperties(_serialization.Model): """Test migrate input properties. All required parameters must be populated in order to send to Azure. - :param provider_specific_details: Required. The provider specific details. - :type provider_specific_details: + :ivar provider_specific_details: The provider specific details. Required. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput """ _validation = { - 'provider_specific_details': {'required': True}, + "provider_specific_details": {"required": True}, } _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'TestMigrateProviderSpecificInput'}, + "provider_specific_details": {"key": "providerSpecificDetails", "type": "TestMigrateProviderSpecificInput"}, } - def __init__( - self, - *, - provider_specific_details: "TestMigrateProviderSpecificInput", - **kwargs - ): - super(TestMigrateInputProperties, self).__init__(**kwargs) + def __init__(self, *, provider_specific_details: "_models.TestMigrateProviderSpecificInput", **kwargs): + """ + :keyword provider_specific_details: The provider specific details. Required. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput + """ + super().__init__(**kwargs) self.provider_specific_details = provider_specific_details -class TestMigrateProviderSpecificInput(msrest.serialization.Model): +class TestMigrateProviderSpecificInput(_serialization.Model): """Test migrate provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtTestMigrateInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtTestMigrateInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtTestMigrateInput'} - } + _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtTestMigrateInput"}} - def __init__( - self, - **kwargs - ): - super(TestMigrateProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class UnplannedFailoverInput(msrest.serialization.Model): +class UnplannedFailoverInput(_serialization.Model): """Input definition for unplanned failover. All required parameters must be populated in order to send to Azure. - :param properties: Required. Unplanned failover input properties. - :type properties: + :ivar properties: Unplanned failover input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UnplannedFailoverInputProperties'}, + "properties": {"key": "properties", "type": "UnplannedFailoverInputProperties"}, } - def __init__( - self, - *, - properties: "UnplannedFailoverInputProperties", - **kwargs - ): - super(UnplannedFailoverInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.UnplannedFailoverInputProperties", **kwargs): + """ + :keyword properties: Unplanned failover input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class UnplannedFailoverInputProperties(msrest.serialization.Model): +class UnplannedFailoverInputProperties(_serialization.Model): """Input definition for unplanned failover input properties. - :param failover_direction: Failover direction. - :type failover_direction: str - :param source_site_operations: Source site operations status. - :type source_site_operations: str - :param provider_specific_details: Provider specific settings. - :type provider_specific_details: + :ivar failover_direction: Failover direction. + :vartype failover_direction: str + :ivar source_site_operations: Source site operations status. + :vartype source_site_operations: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput """ _attribute_map = { - 'failover_direction': {'key': 'failoverDirection', 'type': 'str'}, - 'source_site_operations': {'key': 'sourceSiteOperations', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'UnplannedFailoverProviderSpecificInput'}, + "failover_direction": {"key": "failoverDirection", "type": "str"}, + "source_site_operations": {"key": "sourceSiteOperations", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "UnplannedFailoverProviderSpecificInput", + }, } def __init__( @@ -20066,274 +25101,293 @@ def __init__( *, failover_direction: Optional[str] = None, source_site_operations: Optional[str] = None, - provider_specific_details: Optional["UnplannedFailoverProviderSpecificInput"] = None, - **kwargs - ): - super(UnplannedFailoverInputProperties, self).__init__(**kwargs) + provider_specific_details: Optional["_models.UnplannedFailoverProviderSpecificInput"] = None, + **kwargs + ): + """ + :keyword failover_direction: Failover direction. + :paramtype failover_direction: str + :keyword source_site_operations: Source site operations status. + :paramtype source_site_operations: str + :keyword provider_specific_details: Provider specific settings. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput + """ + super().__init__(**kwargs) self.failover_direction = failover_direction self.source_site_operations = source_site_operations self.provider_specific_details = provider_specific_details -class UpdateApplianceForReplicationProtectedItemInput(msrest.serialization.Model): +class UpdateApplianceForReplicationProtectedItemInput(_serialization.Model): """Update appliance for replication protected item input. All required parameters must be populated in order to send to Azure. - :param properties: Required. Update appliance replication protected item properties. - :type properties: + :ivar properties: Update appliance replication protected item properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateApplianceForReplicationProtectedItemInputProperties'}, + "properties": {"key": "properties", "type": "UpdateApplianceForReplicationProtectedItemInputProperties"}, } - def __init__( - self, - *, - properties: "UpdateApplianceForReplicationProtectedItemInputProperties", - **kwargs - ): - super(UpdateApplianceForReplicationProtectedItemInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.UpdateApplianceForReplicationProtectedItemInputProperties", **kwargs): + """ + :keyword properties: Update appliance replication protected item properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class UpdateApplianceForReplicationProtectedItemInputProperties(msrest.serialization.Model): +class UpdateApplianceForReplicationProtectedItemInputProperties(_serialization.Model): """Update appliance for protected item input properties. All required parameters must be populated in order to send to Azure. - :param target_appliance_id: Required. The target appliance Id. - :type target_appliance_id: str - :param provider_specific_details: Required. The provider specific input to update replication - protected item. - :type provider_specific_details: + :ivar target_appliance_id: The target appliance Id. Required. + :vartype target_appliance_id: str + :ivar provider_specific_details: The provider specific input to update replication protected + item. Required. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput """ _validation = { - 'target_appliance_id': {'required': True}, - 'provider_specific_details': {'required': True}, + "target_appliance_id": {"required": True}, + "provider_specific_details": {"required": True}, } _attribute_map = { - 'target_appliance_id': {'key': 'targetApplianceId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'UpdateApplianceForReplicationProtectedItemProviderSpecificInput'}, + "target_appliance_id": {"key": "targetApplianceId", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "UpdateApplianceForReplicationProtectedItemProviderSpecificInput", + }, } def __init__( self, *, target_appliance_id: str, - provider_specific_details: "UpdateApplianceForReplicationProtectedItemProviderSpecificInput", - **kwargs - ): - super(UpdateApplianceForReplicationProtectedItemInputProperties, self).__init__(**kwargs) + provider_specific_details: "_models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput", + **kwargs + ): + """ + :keyword target_appliance_id: The target appliance Id. Required. + :paramtype target_appliance_id: str + :keyword provider_specific_details: The provider specific input to update replication protected + item. Required. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput + """ + super().__init__(**kwargs) self.target_appliance_id = target_appliance_id self.provider_specific_details = provider_specific_details -class UpdateDiskInput(msrest.serialization.Model): +class UpdateDiskInput(_serialization.Model): """Disk input for update. All required parameters must be populated in order to send to Azure. - :param disk_id: Required. The disk Id. - :type disk_id: str - :param target_disk_name: The target disk name. - :type target_disk_name: str + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar target_disk_name: The target disk name. + :vartype target_disk_name: str """ _validation = { - 'disk_id': {'required': True}, + "disk_id": {"required": True}, } _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "target_disk_name": {"key": "targetDiskName", "type": "str"}, } - def __init__( - self, - *, - disk_id: str, - target_disk_name: Optional[str] = None, - **kwargs - ): - super(UpdateDiskInput, self).__init__(**kwargs) + def __init__(self, *, disk_id: str, target_disk_name: Optional[str] = None, **kwargs): + """ + :keyword disk_id: The disk Id. Required. + :paramtype disk_id: str + :keyword target_disk_name: The target disk name. + :paramtype target_disk_name: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.target_disk_name = target_disk_name -class UpdateMigrationItemInput(msrest.serialization.Model): +class UpdateMigrationItemInput(_serialization.Model): """Update migration item input. - :param properties: Update migration item input properties. - :type properties: + :ivar properties: Update migration item input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateMigrationItemInputProperties'}, + "properties": {"key": "properties", "type": "UpdateMigrationItemInputProperties"}, } - def __init__( - self, - *, - properties: Optional["UpdateMigrationItemInputProperties"] = None, - **kwargs - ): - super(UpdateMigrationItemInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.UpdateMigrationItemInputProperties"] = None, **kwargs): + """ + :keyword properties: Update migration item input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class UpdateMigrationItemInputProperties(msrest.serialization.Model): +class UpdateMigrationItemInputProperties(_serialization.Model): """Update migration item input properties. All required parameters must be populated in order to send to Azure. - :param provider_specific_details: Required. The provider specific input to update migration - item. - :type provider_specific_details: + :ivar provider_specific_details: The provider specific input to update migration item. + Required. + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput """ _validation = { - 'provider_specific_details': {'required': True}, + "provider_specific_details": {"required": True}, } _attribute_map = { - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'UpdateMigrationItemProviderSpecificInput'}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "UpdateMigrationItemProviderSpecificInput", + }, } - def __init__( - self, - *, - provider_specific_details: "UpdateMigrationItemProviderSpecificInput", - **kwargs - ): - super(UpdateMigrationItemInputProperties, self).__init__(**kwargs) + def __init__(self, *, provider_specific_details: "_models.UpdateMigrationItemProviderSpecificInput", **kwargs): + """ + :keyword provider_specific_details: The provider specific input to update migration item. + Required. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput + """ + super().__init__(**kwargs) self.provider_specific_details = provider_specific_details -class UpdateMigrationItemProviderSpecificInput(msrest.serialization.Model): +class UpdateMigrationItemProviderSpecificInput(_serialization.Model): """Update migration item provider specific input. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VMwareCbtUpdateMigrationItemInput. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtUpdateMigrationItemInput All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - _subtype_map = { - 'instance_type': {'VMwareCbt': 'VMwareCbtUpdateMigrationItemInput'} - } + _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtUpdateMigrationItemInput"}} - def __init__( - self, - **kwargs - ): - super(UpdateMigrationItemProviderSpecificInput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.instance_type = None # type: Optional[str] -class UpdateMobilityServiceRequest(msrest.serialization.Model): +class UpdateMobilityServiceRequest(_serialization.Model): """Request to update the mobility service on a protected item. - :param properties: The properties of the update mobility service request. - :type properties: + :ivar properties: The properties of the update mobility service request. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequestProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateMobilityServiceRequestProperties'}, + "properties": {"key": "properties", "type": "UpdateMobilityServiceRequestProperties"}, } - def __init__( - self, - *, - properties: Optional["UpdateMobilityServiceRequestProperties"] = None, - **kwargs - ): - super(UpdateMobilityServiceRequest, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.UpdateMobilityServiceRequestProperties"] = None, **kwargs): + """ + :keyword properties: The properties of the update mobility service request. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequestProperties + """ + super().__init__(**kwargs) self.properties = properties -class UpdateMobilityServiceRequestProperties(msrest.serialization.Model): +class UpdateMobilityServiceRequestProperties(_serialization.Model): """The properties of an update mobility service request. - :param run_as_account_id: The CS run as account Id. - :type run_as_account_id: str + :ivar run_as_account_id: The CS run as account Id. + :vartype run_as_account_id: str """ _attribute_map = { - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, } - def __init__( - self, - *, - run_as_account_id: Optional[str] = None, - **kwargs - ): - super(UpdateMobilityServiceRequestProperties, self).__init__(**kwargs) + def __init__(self, *, run_as_account_id: Optional[str] = None, **kwargs): + """ + :keyword run_as_account_id: The CS run as account Id. + :paramtype run_as_account_id: str + """ + super().__init__(**kwargs) self.run_as_account_id = run_as_account_id -class UpdateNetworkMappingInput(msrest.serialization.Model): +class UpdateNetworkMappingInput(_serialization.Model): """Update network mapping input. - :param properties: The input properties needed to update network mapping. - :type properties: + :ivar properties: The input properties needed to update network mapping. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateNetworkMappingInputProperties'}, + "properties": {"key": "properties", "type": "UpdateNetworkMappingInputProperties"}, } - def __init__( - self, - *, - properties: Optional["UpdateNetworkMappingInputProperties"] = None, - **kwargs - ): - super(UpdateNetworkMappingInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.UpdateNetworkMappingInputProperties"] = None, **kwargs): + """ + :keyword properties: The input properties needed to update network mapping. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class UpdateNetworkMappingInputProperties(msrest.serialization.Model): +class UpdateNetworkMappingInputProperties(_serialization.Model): """Common input details for network mapping operation. - :param recovery_fabric_name: Recovery fabric name. - :type recovery_fabric_name: str - :param recovery_network_id: Recovery network Id. - :type recovery_network_id: str - :param fabric_specific_details: Fabrics specific input network Id. - :type fabric_specific_details: + :ivar recovery_fabric_name: Recovery fabric name. + :vartype recovery_fabric_name: str + :ivar recovery_network_id: Recovery network Id. + :vartype recovery_network_id: str + :ivar fabric_specific_details: Fabrics specific input network Id. + :vartype fabric_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput """ _attribute_map = { - 'recovery_fabric_name': {'key': 'recoveryFabricName', 'type': 'str'}, - 'recovery_network_id': {'key': 'recoveryNetworkId', 'type': 'str'}, - 'fabric_specific_details': {'key': 'fabricSpecificDetails', 'type': 'FabricSpecificUpdateNetworkMappingInput'}, + "recovery_fabric_name": {"key": "recoveryFabricName", "type": "str"}, + "recovery_network_id": {"key": "recoveryNetworkId", "type": "str"}, + "fabric_specific_details": {"key": "fabricSpecificDetails", "type": "FabricSpecificUpdateNetworkMappingInput"}, } def __init__( @@ -20341,209 +25395,236 @@ def __init__( *, recovery_fabric_name: Optional[str] = None, recovery_network_id: Optional[str] = None, - fabric_specific_details: Optional["FabricSpecificUpdateNetworkMappingInput"] = None, - **kwargs - ): - super(UpdateNetworkMappingInputProperties, self).__init__(**kwargs) + fabric_specific_details: Optional["_models.FabricSpecificUpdateNetworkMappingInput"] = None, + **kwargs + ): + """ + :keyword recovery_fabric_name: Recovery fabric name. + :paramtype recovery_fabric_name: str + :keyword recovery_network_id: Recovery network Id. + :paramtype recovery_network_id: str + :keyword fabric_specific_details: Fabrics specific input network Id. + :paramtype fabric_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput + """ + super().__init__(**kwargs) self.recovery_fabric_name = recovery_fabric_name self.recovery_network_id = recovery_network_id self.fabric_specific_details = fabric_specific_details -class UpdatePolicyInput(msrest.serialization.Model): +class UpdatePolicyInput(_serialization.Model): """Update policy input. - :param properties: The ReplicationProviderSettings. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInputProperties + :ivar properties: The ReplicationProviderSettings. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdatePolicyInputProperties'}, + "properties": {"key": "properties", "type": "UpdatePolicyInputProperties"}, } - def __init__( - self, - *, - properties: Optional["UpdatePolicyInputProperties"] = None, - **kwargs - ): - super(UpdatePolicyInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.UpdatePolicyInputProperties"] = None, **kwargs): + """ + :keyword properties: The ReplicationProviderSettings. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class UpdatePolicyInputProperties(msrest.serialization.Model): +class UpdatePolicyInputProperties(_serialization.Model): """Policy update properties. - :param replication_provider_settings: The ReplicationProviderSettings. - :type replication_provider_settings: + :ivar replication_provider_settings: The ReplicationProviderSettings. + :vartype replication_provider_settings: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput """ _attribute_map = { - 'replication_provider_settings': {'key': 'replicationProviderSettings', 'type': 'PolicyProviderSpecificInput'}, + "replication_provider_settings": {"key": "replicationProviderSettings", "type": "PolicyProviderSpecificInput"}, } def __init__( - self, - *, - replication_provider_settings: Optional["PolicyProviderSpecificInput"] = None, - **kwargs + self, *, replication_provider_settings: Optional["_models.PolicyProviderSpecificInput"] = None, **kwargs ): - super(UpdatePolicyInputProperties, self).__init__(**kwargs) + """ + :keyword replication_provider_settings: The ReplicationProviderSettings. + :paramtype replication_provider_settings: + ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput + """ + super().__init__(**kwargs) self.replication_provider_settings = replication_provider_settings -class UpdateProtectionContainerMappingInput(msrest.serialization.Model): +class UpdateProtectionContainerMappingInput(_serialization.Model): """Container pairing update input. - :param properties: Update protection container mapping input properties. - :type properties: + :ivar properties: Update protection container mapping input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateProtectionContainerMappingInputProperties'}, + "properties": {"key": "properties", "type": "UpdateProtectionContainerMappingInputProperties"}, } def __init__( - self, - *, - properties: Optional["UpdateProtectionContainerMappingInputProperties"] = None, - **kwargs + self, *, properties: Optional["_models.UpdateProtectionContainerMappingInputProperties"] = None, **kwargs ): - super(UpdateProtectionContainerMappingInput, self).__init__(**kwargs) + """ + :keyword properties: Update protection container mapping input properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class UpdateProtectionContainerMappingInputProperties(msrest.serialization.Model): +class UpdateProtectionContainerMappingInputProperties(_serialization.Model): """Container pairing update input. - :param provider_specific_input: Provider specific input for updating protection container + :ivar provider_specific_input: Provider specific input for updating protection container mapping. - :type provider_specific_input: + :vartype provider_specific_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificUpdateContainerMappingInput """ _attribute_map = { - 'provider_specific_input': {'key': 'providerSpecificInput', 'type': 'ReplicationProviderSpecificUpdateContainerMappingInput'}, + "provider_specific_input": { + "key": "providerSpecificInput", + "type": "ReplicationProviderSpecificUpdateContainerMappingInput", + }, } def __init__( self, *, - provider_specific_input: Optional["ReplicationProviderSpecificUpdateContainerMappingInput"] = None, + provider_specific_input: Optional["_models.ReplicationProviderSpecificUpdateContainerMappingInput"] = None, **kwargs ): - super(UpdateProtectionContainerMappingInputProperties, self).__init__(**kwargs) + """ + :keyword provider_specific_input: Provider specific input for updating protection container + mapping. + :paramtype provider_specific_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificUpdateContainerMappingInput + """ + super().__init__(**kwargs) self.provider_specific_input = provider_specific_input -class UpdateRecoveryPlanInput(msrest.serialization.Model): +class UpdateRecoveryPlanInput(_serialization.Model): """Update recovery plan input class. - :param properties: Recovery plan update properties. - :type properties: + :ivar properties: Recovery plan update properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateRecoveryPlanInputProperties'}, + "properties": {"key": "properties", "type": "UpdateRecoveryPlanInputProperties"}, } - def __init__( - self, - *, - properties: Optional["UpdateRecoveryPlanInputProperties"] = None, - **kwargs - ): - super(UpdateRecoveryPlanInput, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.UpdateRecoveryPlanInputProperties"] = None, **kwargs): + """ + :keyword properties: Recovery plan update properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class UpdateRecoveryPlanInputProperties(msrest.serialization.Model): +class UpdateRecoveryPlanInputProperties(_serialization.Model): """Recovery plan update properties. - :param groups: The recovery plan groups. - :type groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] + :ivar groups: The recovery plan groups. + :vartype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] """ _attribute_map = { - 'groups': {'key': 'groups', 'type': '[RecoveryPlanGroup]'}, + "groups": {"key": "groups", "type": "[RecoveryPlanGroup]"}, } - def __init__( - self, - *, - groups: Optional[List["RecoveryPlanGroup"]] = None, - **kwargs - ): - super(UpdateRecoveryPlanInputProperties, self).__init__(**kwargs) + def __init__(self, *, groups: Optional[List["_models.RecoveryPlanGroup"]] = None, **kwargs): + """ + :keyword groups: The recovery plan groups. + :paramtype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] + """ + super().__init__(**kwargs) self.groups = groups -class UpdateReplicationProtectedItemInput(msrest.serialization.Model): +class UpdateReplicationProtectedItemInput(_serialization.Model): """Update replication protected item input. - :param properties: Update replication protected item properties. - :type properties: + :ivar properties: Update replication protected item properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInputProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateReplicationProtectedItemInputProperties'}, + "properties": {"key": "properties", "type": "UpdateReplicationProtectedItemInputProperties"}, } - - def __init__( - self, - *, - properties: Optional["UpdateReplicationProtectedItemInputProperties"] = None, - **kwargs + + def __init__( + self, *, properties: Optional["_models.UpdateReplicationProtectedItemInputProperties"] = None, **kwargs ): - super(UpdateReplicationProtectedItemInput, self).__init__(**kwargs) + """ + :keyword properties: Update replication protected item properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class UpdateReplicationProtectedItemInputProperties(msrest.serialization.Model): +class UpdateReplicationProtectedItemInputProperties(_serialization.Model): """Update protected item input properties. - :param recovery_azure_vm_name: Target Azure VM name given by the user. - :type recovery_azure_vm_name: str - :param recovery_azure_vm_size: Target Azure VM size. - :type recovery_azure_vm_size: str - :param selected_recovery_azure_network_id: Target Azure Network Id. - :type selected_recovery_azure_network_id: str - :param selected_tfo_azure_network_id: The Azure Network Id for test failover. - :type selected_tfo_azure_network_id: str - :param selected_source_nic_id: The selected source nic Id which will be used as the primary nic + :ivar recovery_azure_vm_name: Target Azure VM name given by the user. + :vartype recovery_azure_vm_name: str + :ivar recovery_azure_vm_size: Target Azure VM size. + :vartype recovery_azure_vm_size: str + :ivar selected_recovery_azure_network_id: Target Azure Network Id. + :vartype selected_recovery_azure_network_id: str + :ivar selected_tfo_azure_network_id: The Azure Network Id for test failover. + :vartype selected_tfo_azure_network_id: str + :ivar selected_source_nic_id: The selected source nic Id which will be used as the primary nic during failover. - :type selected_source_nic_id: str - :param enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after + :vartype selected_source_nic_id: str + :ivar enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :type enable_rdp_on_target_option: str - :param vm_nics: The list of VM nic details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicInputDetails] - :param license_type: License type. Possible values include: "NotSpecified", "NoLicenseType", + :vartype enable_rdp_on_target_option: str + :ivar vm_nics: The list of VM nic details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicInputDetails] + :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param recovery_availability_set_id: The target availability set Id. - :type recovery_availability_set_id: str - :param provider_specific_details: The provider specific input to update replication protected + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar recovery_availability_set_id: The target availability set Id. + :vartype recovery_availability_set_id: str + :ivar provider_specific_details: The provider specific input to update replication protected item. - :type provider_specific_details: + :vartype provider_specific_details: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput """ _attribute_map = { - 'recovery_azure_vm_name': {'key': 'recoveryAzureVMName', 'type': 'str'}, - 'recovery_azure_vm_size': {'key': 'recoveryAzureVMSize', 'type': 'str'}, - 'selected_recovery_azure_network_id': {'key': 'selectedRecoveryAzureNetworkId', 'type': 'str'}, - 'selected_tfo_azure_network_id': {'key': 'selectedTfoAzureNetworkId', 'type': 'str'}, - 'selected_source_nic_id': {'key': 'selectedSourceNicId', 'type': 'str'}, - 'enable_rdp_on_target_option': {'key': 'enableRdpOnTargetOption', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMNicInputDetails]'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'recovery_availability_set_id': {'key': 'recoveryAvailabilitySetId', 'type': 'str'}, - 'provider_specific_details': {'key': 'providerSpecificDetails', 'type': 'UpdateReplicationProtectedItemProviderInput'}, + "recovery_azure_vm_name": {"key": "recoveryAzureVMName", "type": "str"}, + "recovery_azure_vm_size": {"key": "recoveryAzureVMSize", "type": "str"}, + "selected_recovery_azure_network_id": {"key": "selectedRecoveryAzureNetworkId", "type": "str"}, + "selected_tfo_azure_network_id": {"key": "selectedTfoAzureNetworkId", "type": "str"}, + "selected_source_nic_id": {"key": "selectedSourceNicId", "type": "str"}, + "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, + "vm_nics": {"key": "vmNics", "type": "[VMNicInputDetails]"}, + "license_type": {"key": "licenseType", "type": "str"}, + "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, + "provider_specific_details": { + "key": "providerSpecificDetails", + "type": "UpdateReplicationProtectedItemProviderInput", + }, } def __init__( @@ -20555,13 +25636,40 @@ def __init__( selected_tfo_azure_network_id: Optional[str] = None, selected_source_nic_id: Optional[str] = None, enable_rdp_on_target_option: Optional[str] = None, - vm_nics: Optional[List["VMNicInputDetails"]] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + vm_nics: Optional[List["_models.VMNicInputDetails"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, recovery_availability_set_id: Optional[str] = None, - provider_specific_details: Optional["UpdateReplicationProtectedItemProviderInput"] = None, - **kwargs - ): - super(UpdateReplicationProtectedItemInputProperties, self).__init__(**kwargs) + provider_specific_details: Optional["_models.UpdateReplicationProtectedItemProviderInput"] = None, + **kwargs + ): + """ + :keyword recovery_azure_vm_name: Target Azure VM name given by the user. + :paramtype recovery_azure_vm_name: str + :keyword recovery_azure_vm_size: Target Azure VM size. + :paramtype recovery_azure_vm_size: str + :keyword selected_recovery_azure_network_id: Target Azure Network Id. + :paramtype selected_recovery_azure_network_id: str + :keyword selected_tfo_azure_network_id: The Azure Network Id for test failover. + :paramtype selected_tfo_azure_network_id: str + :keyword selected_source_nic_id: The selected source nic Id which will be used as the primary + nic during failover. + :paramtype selected_source_nic_id: str + :keyword enable_rdp_on_target_option: The selected option to enable RDP\SSH on target vm after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :paramtype enable_rdp_on_target_option: str + :keyword vm_nics: The list of VM nic details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicInputDetails] + :keyword license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :keyword recovery_availability_set_id: The target availability set Id. + :paramtype recovery_availability_set_id: str + :keyword provider_specific_details: The provider specific input to update replication protected + item. + :paramtype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput + """ + super().__init__(**kwargs) self.recovery_azure_vm_name = recovery_azure_vm_name self.recovery_azure_vm_size = recovery_azure_vm_size self.selected_recovery_azure_network_id = selected_recovery_azure_network_id @@ -20574,49 +25682,49 @@ def __init__( self.provider_specific_details = provider_specific_details -class UpdateVCenterRequest(msrest.serialization.Model): +class UpdateVCenterRequest(_serialization.Model): """Input required to update vCenter. - :param properties: The update VCenter Request Properties. - :type properties: + :ivar properties: The update VCenter Request Properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequestProperties """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'UpdateVCenterRequestProperties'}, + "properties": {"key": "properties", "type": "UpdateVCenterRequestProperties"}, } - def __init__( - self, - *, - properties: Optional["UpdateVCenterRequestProperties"] = None, - **kwargs - ): - super(UpdateVCenterRequest, self).__init__(**kwargs) + def __init__(self, *, properties: Optional["_models.UpdateVCenterRequestProperties"] = None, **kwargs): + """ + :keyword properties: The update VCenter Request Properties. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequestProperties + """ + super().__init__(**kwargs) self.properties = properties -class UpdateVCenterRequestProperties(msrest.serialization.Model): +class UpdateVCenterRequestProperties(_serialization.Model): """The properties of an update vCenter request. - :param friendly_name: The friendly name of the vCenter. - :type friendly_name: str - :param ip_address: The IP address of the vCenter to be discovered. - :type ip_address: str - :param process_server_id: The process server Id from where the update can be orchestrated. - :type process_server_id: str - :param port: The port number for discovery. - :type port: str - :param run_as_account_id: The CS account Id which has privileges to update the vCenter. - :type run_as_account_id: str + :ivar friendly_name: The friendly name of the vCenter. + :vartype friendly_name: str + :ivar ip_address: The IP address of the vCenter to be discovered. + :vartype ip_address: str + :ivar process_server_id: The process server Id from where the update can be orchestrated. + :vartype process_server_id: str + :ivar port: The port number for discovery. + :vartype port: str + :ivar run_as_account_id: The CS account Id which has privileges to update the vCenter. + :vartype run_as_account_id: str """ _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "port": {"key": "port", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, } def __init__( @@ -20629,7 +25737,19 @@ def __init__( run_as_account_id: Optional[str] = None, **kwargs ): - super(UpdateVCenterRequestProperties, self).__init__(**kwargs) + """ + :keyword friendly_name: The friendly name of the vCenter. + :paramtype friendly_name: str + :keyword ip_address: The IP address of the vCenter to be discovered. + :paramtype ip_address: str + :keyword process_server_id: The process server Id from where the update can be orchestrated. + :paramtype process_server_id: str + :keyword port: The port number for discovery. + :paramtype port: str + :keyword run_as_account_id: The CS account Id which has privileges to update the vCenter. + :paramtype run_as_account_id: str + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.ip_address = ip_address self.process_server_id = process_server_id @@ -20648,69 +25768,86 @@ class VaultHealthDetails(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The vault health related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The vault health related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VaultHealthProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "VaultHealthProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["VaultHealthProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.VaultHealthProperties"] = None, **kwargs ): - super(VaultHealthDetails, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The vault health related data. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class VaultHealthProperties(msrest.serialization.Model): +class VaultHealthProperties(_serialization.Model): """class to define the health summary of the Vault. - :param vault_errors: The list of errors on the vault. - :type vault_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :param protected_items_health: The list of the health detail of the protected items in the + :ivar vault_errors: The list of errors on the vault. + :vartype vault_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar protected_items_health: The list of the health detail of the protected items in the vault. - :type protected_items_health: + :vartype protected_items_health: + ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary + :ivar fabrics_health: The list of the health detail of the fabrics in the vault. + :vartype fabrics_health: ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary + :ivar containers_health: The list of the health detail of the containers in the vault. + :vartype containers_health: ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - :param fabrics_health: The list of the health detail of the fabrics in the vault. - :type fabrics_health: ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - :param containers_health: The list of the health detail of the containers in the vault. - :type containers_health: ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary """ _attribute_map = { - 'vault_errors': {'key': 'vaultErrors', 'type': '[HealthError]'}, - 'protected_items_health': {'key': 'protectedItemsHealth', 'type': 'ResourceHealthSummary'}, - 'fabrics_health': {'key': 'fabricsHealth', 'type': 'ResourceHealthSummary'}, - 'containers_health': {'key': 'containersHealth', 'type': 'ResourceHealthSummary'}, + "vault_errors": {"key": "vaultErrors", "type": "[HealthError]"}, + "protected_items_health": {"key": "protectedItemsHealth", "type": "ResourceHealthSummary"}, + "fabrics_health": {"key": "fabricsHealth", "type": "ResourceHealthSummary"}, + "containers_health": {"key": "containersHealth", "type": "ResourceHealthSummary"}, } def __init__( self, *, - vault_errors: Optional[List["HealthError"]] = None, - protected_items_health: Optional["ResourceHealthSummary"] = None, - fabrics_health: Optional["ResourceHealthSummary"] = None, - containers_health: Optional["ResourceHealthSummary"] = None, + vault_errors: Optional[List["_models.HealthError"]] = None, + protected_items_health: Optional["_models.ResourceHealthSummary"] = None, + fabrics_health: Optional["_models.ResourceHealthSummary"] = None, + containers_health: Optional["_models.ResourceHealthSummary"] = None, **kwargs ): - super(VaultHealthProperties, self).__init__(**kwargs) + """ + :keyword vault_errors: The list of errors on the vault. + :paramtype vault_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :keyword protected_items_health: The list of the health detail of the protected items in the + vault. + :paramtype protected_items_health: + ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary + :keyword fabrics_health: The list of the health detail of the fabrics in the vault. + :paramtype fabrics_health: + ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary + :keyword containers_health: The list of the health detail of the containers in the vault. + :paramtype containers_health: + ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary + """ + super().__init__(**kwargs) self.vault_errors = vault_errors self.protected_items_health = protected_items_health self.fabrics_health = fabrics_health @@ -20728,103 +25865,107 @@ class VaultSetting(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: The vault setting properties. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: The vault setting properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VaultSettingProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "VaultSettingProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["VaultSettingProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.VaultSettingProperties"] = None, **kwargs ): - super(VaultSetting, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: The vault setting properties. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class VaultSettingCollection(msrest.serialization.Model): +class VaultSettingCollection(_serialization.Model): """Vault setting collection. - :param value: The list of vault setting. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The list of vault setting. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[VaultSetting]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[VaultSetting]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["VaultSetting"]] = None, - next_link: Optional[str] = None, - **kwargs + self, *, value: Optional[List["_models.VaultSetting"]] = None, next_link: Optional[str] = None, **kwargs ): - super(VaultSettingCollection, self).__init__(**kwargs) + """ + :keyword value: The list of vault setting. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class VaultSettingCreationInput(msrest.serialization.Model): +class VaultSettingCreationInput(_serialization.Model): """Input to create vault setting. All required parameters must be populated in order to send to Azure. - :param properties: Required. Vault setting creation input properties. - :type properties: + :ivar properties: Vault setting creation input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties """ _validation = { - 'properties': {'required': True}, + "properties": {"required": True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'VaultSettingCreationInputProperties'}, + "properties": {"key": "properties", "type": "VaultSettingCreationInputProperties"}, } - def __init__( - self, - *, - properties: "VaultSettingCreationInputProperties", - **kwargs - ): - super(VaultSettingCreationInput, self).__init__(**kwargs) + def __init__(self, *, properties: "_models.VaultSettingCreationInputProperties", **kwargs): + """ + :keyword properties: Vault setting creation input properties. Required. + :paramtype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties + """ + super().__init__(**kwargs) self.properties = properties -class VaultSettingCreationInputProperties(msrest.serialization.Model): +class VaultSettingCreationInputProperties(_serialization.Model): """Input to create vault setting. - :param migration_solution_id: The migration solution Id. - :type migration_solution_id: str - :param vmware_to_azure_provider_type: VMware to Azure provider type. - :type vmware_to_azure_provider_type: str + :ivar migration_solution_id: The migration solution Id. + :vartype migration_solution_id: str + :ivar vmware_to_azure_provider_type: VMware to Azure provider type. + :vartype vmware_to_azure_provider_type: str """ _attribute_map = { - 'migration_solution_id': {'key': 'migrationSolutionId', 'type': 'str'}, - 'vmware_to_azure_provider_type': {'key': 'vmwareToAzureProviderType', 'type': 'str'}, + "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, + "vmware_to_azure_provider_type": {"key": "vmwareToAzureProviderType", "type": "str"}, } def __init__( @@ -20834,23 +25975,29 @@ def __init__( vmware_to_azure_provider_type: Optional[str] = None, **kwargs ): - super(VaultSettingCreationInputProperties, self).__init__(**kwargs) + """ + :keyword migration_solution_id: The migration solution Id. + :paramtype migration_solution_id: str + :keyword vmware_to_azure_provider_type: VMware to Azure provider type. + :paramtype vmware_to_azure_provider_type: str + """ + super().__init__(**kwargs) self.migration_solution_id = migration_solution_id self.vmware_to_azure_provider_type = vmware_to_azure_provider_type -class VaultSettingProperties(msrest.serialization.Model): +class VaultSettingProperties(_serialization.Model): """Vault setting properties. - :param migration_solution_id: The migration solution ARM Id. - :type migration_solution_id: str - :param vmware_to_azure_provider_type: VMware to Azure provider type. - :type vmware_to_azure_provider_type: str + :ivar migration_solution_id: The migration solution ARM Id. + :vartype migration_solution_id: str + :ivar vmware_to_azure_provider_type: VMware to Azure provider type. + :vartype vmware_to_azure_provider_type: str """ _attribute_map = { - 'migration_solution_id': {'key': 'migrationSolutionId', 'type': 'str'}, - 'vmware_to_azure_provider_type': {'key': 'vmwareToAzureProviderType', 'type': 'str'}, + "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, + "vmware_to_azure_provider_type": {"key": "vmwareToAzureProviderType", "type": "str"}, } def __init__( @@ -20860,7 +26007,13 @@ def __init__( vmware_to_azure_provider_type: Optional[str] = None, **kwargs ): - super(VaultSettingProperties, self).__init__(**kwargs) + """ + :keyword migration_solution_id: The migration solution ARM Id. + :paramtype migration_solution_id: str + :keyword vmware_to_azure_provider_type: VMware to Azure provider type. + :paramtype vmware_to_azure_provider_type: str + """ + super().__init__(**kwargs) self.migration_solution_id = migration_solution_id self.vmware_to_azure_provider_type = vmware_to_azure_provider_type @@ -20876,102 +26029,104 @@ class VCenter(Resource): :vartype name: str :ivar type: Resource Type. :vartype type: str - :param location: Resource Location. - :type location: str - :param properties: VCenter related data. - :type properties: ~azure.mgmt.recoveryservicessiterecovery.models.VCenterProperties + :ivar location: Resource Location. + :vartype location: str + :ivar properties: VCenter related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VCenterProperties """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VCenterProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "VCenterProperties"}, } def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["VCenterProperties"] = None, - **kwargs + self, *, location: Optional[str] = None, properties: Optional["_models.VCenterProperties"] = None, **kwargs ): - super(VCenter, self).__init__(location=location, **kwargs) + """ + :keyword location: Resource Location. + :paramtype location: str + :keyword properties: VCenter related data. + :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VCenterProperties + """ + super().__init__(location=location, **kwargs) self.properties = properties -class VCenterCollection(msrest.serialization.Model): +class VCenterCollection(_serialization.Model): """Collection of vCenter details. - :param value: The vCenter details. - :type value: list[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :param next_link: The value of next link. - :type next_link: str + :ivar value: The vCenter details. + :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :ivar next_link: The value of next link. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[VCenter]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[VCenter]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["VCenter"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(VCenterCollection, self).__init__(**kwargs) + def __init__(self, *, value: Optional[List["_models.VCenter"]] = None, next_link: Optional[str] = None, **kwargs): + """ + :keyword value: The vCenter details. + :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :keyword next_link: The value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) self.value = value self.next_link = next_link -class VCenterProperties(msrest.serialization.Model): +class VCenterProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """vCenter properties. - :param friendly_name: Friendly name of the vCenter. - :type friendly_name: str - :param internal_id: VCenter internal ID. - :type internal_id: str - :param last_heartbeat: The time when the last heartbeat was received by vCenter. - :type last_heartbeat: ~datetime.datetime - :param discovery_status: The VCenter discovery status. - :type discovery_status: str - :param process_server_id: The process server Id. - :type process_server_id: str - :param ip_address: The IP address of the vCenter. - :type ip_address: str - :param infrastructure_id: The infrastructure Id of vCenter. - :type infrastructure_id: str - :param port: The port number for discovery. - :type port: str - :param run_as_account_id: The account Id which has privileges to discover the vCenter. - :type run_as_account_id: str - :param fabric_arm_resource_name: The ARM resource name of the fabric containing this VCenter. - :type fabric_arm_resource_name: str - :param health_errors: The health errors for this VCenter. - :type health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'internal_id': {'key': 'internalId', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'discovery_status': {'key': 'discoveryStatus', 'type': 'str'}, - 'process_server_id': {'key': 'processServerId', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'infrastructure_id': {'key': 'infrastructureId', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'str'}, - 'run_as_account_id': {'key': 'runAsAccountId', 'type': 'str'}, - 'fabric_arm_resource_name': {'key': 'fabricArmResourceName', 'type': 'str'}, - 'health_errors': {'key': 'healthErrors', 'type': '[HealthError]'}, + :ivar friendly_name: Friendly name of the vCenter. + :vartype friendly_name: str + :ivar internal_id: VCenter internal ID. + :vartype internal_id: str + :ivar last_heartbeat: The time when the last heartbeat was received by vCenter. + :vartype last_heartbeat: ~datetime.datetime + :ivar discovery_status: The VCenter discovery status. + :vartype discovery_status: str + :ivar process_server_id: The process server Id. + :vartype process_server_id: str + :ivar ip_address: The IP address of the vCenter. + :vartype ip_address: str + :ivar infrastructure_id: The infrastructure Id of vCenter. + :vartype infrastructure_id: str + :ivar port: The port number for discovery. + :vartype port: str + :ivar run_as_account_id: The account Id which has privileges to discover the vCenter. + :vartype run_as_account_id: str + :ivar fabric_arm_resource_name: The ARM resource name of the fabric containing this VCenter. + :vartype fabric_arm_resource_name: str + :ivar health_errors: The health errors for this VCenter. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + + _attribute_map = { + "friendly_name": {"key": "friendlyName", "type": "str"}, + "internal_id": {"key": "internalId", "type": "str"}, + "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, + "discovery_status": {"key": "discoveryStatus", "type": "str"}, + "process_server_id": {"key": "processServerId", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "infrastructure_id": {"key": "infrastructureId", "type": "str"}, + "port": {"key": "port", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, + "fabric_arm_resource_name": {"key": "fabricArmResourceName", "type": "str"}, + "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, } def __init__( @@ -20987,10 +26142,34 @@ def __init__( port: Optional[str] = None, run_as_account_id: Optional[str] = None, fabric_arm_resource_name: Optional[str] = None, - health_errors: Optional[List["HealthError"]] = None, - **kwargs - ): - super(VCenterProperties, self).__init__(**kwargs) + health_errors: Optional[List["_models.HealthError"]] = None, + **kwargs + ): + """ + :keyword friendly_name: Friendly name of the vCenter. + :paramtype friendly_name: str + :keyword internal_id: VCenter internal ID. + :paramtype internal_id: str + :keyword last_heartbeat: The time when the last heartbeat was received by vCenter. + :paramtype last_heartbeat: ~datetime.datetime + :keyword discovery_status: The VCenter discovery status. + :paramtype discovery_status: str + :keyword process_server_id: The process server Id. + :paramtype process_server_id: str + :keyword ip_address: The IP address of the vCenter. + :paramtype ip_address: str + :keyword infrastructure_id: The infrastructure Id of vCenter. + :paramtype infrastructure_id: str + :keyword port: The port number for discovery. + :paramtype port: str + :keyword run_as_account_id: The account Id which has privileges to discover the vCenter. + :paramtype run_as_account_id: str + :keyword fabric_arm_resource_name: The ARM resource name of the fabric containing this VCenter. + :paramtype fabric_arm_resource_name: str + :keyword health_errors: The health errors for this VCenter. + :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + super().__init__(**kwargs) self.friendly_name = friendly_name self.internal_id = internal_id self.last_heartbeat = last_heartbeat @@ -21004,22 +26183,22 @@ def __init__( self.health_errors = health_errors -class VersionDetails(msrest.serialization.Model): +class VersionDetails(_serialization.Model): """Version related details. - :param version: The agent version. - :type version: str - :param expiry_date: Version expiry date. - :type expiry_date: ~datetime.datetime - :param status: A value indicating whether security update required. Possible values include: - "Supported", "NotSupported", "Deprecated", "UpdateRequired", "SecurityUpdateRequired". - :type status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentVersionStatus + :ivar version: The agent version. + :vartype version: str + :ivar expiry_date: Version expiry date. + :vartype expiry_date: ~datetime.datetime + :ivar status: A value indicating whether security update required. Known values are: + "Supported", "NotSupported", "Deprecated", "UpdateRequired", and "SecurityUpdateRequired". + :vartype status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentVersionStatus """ _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'expiry_date': {'key': 'expiryDate', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, + "version": {"key": "version", "type": "str"}, + "expiry_date": {"key": "expiryDate", "type": "iso-8601"}, + "status": {"key": "status", "type": "str"}, } def __init__( @@ -21027,10 +26206,19 @@ def __init__( *, version: Optional[str] = None, expiry_date: Optional[datetime.datetime] = None, - status: Optional[Union[str, "AgentVersionStatus"]] = None, - **kwargs - ): - super(VersionDetails, self).__init__(**kwargs) + status: Optional[Union[str, "_models.AgentVersionStatus"]] = None, + **kwargs + ): + """ + :keyword version: The agent version. + :paramtype version: str + :keyword expiry_date: Version expiry date. + :paramtype expiry_date: ~datetime.datetime + :keyword status: A value indicating whether security update required. Known values are: + "Supported", "NotSupported", "Deprecated", "UpdateRequired", and "SecurityUpdateRequired". + :paramtype status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentVersionStatus + """ + super().__init__(**kwargs) self.version = version self.expiry_date = expiry_date self.status = status @@ -21041,37 +26229,45 @@ class VirtualMachineTaskDetails(JobTaskDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param job_task: The job entity. - :type job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - :param skipped_reason: The skipped reason. - :type skipped_reason: str - :param skipped_reason_string: The skipped reason string. - :type skipped_reason_string: str + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar job_task: The job entity. + :vartype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity + :ivar skipped_reason: The skipped reason. + :vartype skipped_reason: str + :ivar skipped_reason_string: The skipped reason string. + :vartype skipped_reason_string: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'job_task': {'key': 'jobTask', 'type': 'JobEntity'}, - 'skipped_reason': {'key': 'skippedReason', 'type': 'str'}, - 'skipped_reason_string': {'key': 'skippedReasonString', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "job_task": {"key": "jobTask", "type": "JobEntity"}, + "skipped_reason": {"key": "skippedReason", "type": "str"}, + "skipped_reason_string": {"key": "skippedReasonString", "type": "str"}, } def __init__( self, *, - job_task: Optional["JobEntity"] = None, + job_task: Optional["_models.JobEntity"] = None, skipped_reason: Optional[str] = None, skipped_reason_string: Optional[str] = None, **kwargs ): - super(VirtualMachineTaskDetails, self).__init__(job_task=job_task, **kwargs) - self.instance_type = 'VirtualMachineTaskDetails' # type: str + """ + :keyword job_task: The job entity. + :paramtype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity + :keyword skipped_reason: The skipped reason. + :paramtype skipped_reason: str + :keyword skipped_reason_string: The skipped reason string. + :paramtype skipped_reason_string: str + """ + super().__init__(job_task=job_task, **kwargs) + self.instance_type = "VirtualMachineTaskDetails" # type: str self.skipped_reason = skipped_reason self.skipped_reason_string = skipped_reason_string @@ -21081,25 +26277,22 @@ class VmmDetails(FabricSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VmmDetails, self).__init__(**kwargs) - self.instance_type = 'VMM' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VMM" # type: str class VmmToAzureCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput): @@ -21107,24 +26300,22 @@ class VmmToAzureCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInpu All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VmmToAzureCreateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'VmmToAzure' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VmmToAzure" # type: str class VmmToAzureNetworkMappingSettings(NetworkMappingFabricSpecificSettings): @@ -21132,24 +26323,22 @@ class VmmToAzureNetworkMappingSettings(NetworkMappingFabricSpecificSettings): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VmmToAzureNetworkMappingSettings, self).__init__(**kwargs) - self.instance_type = 'VmmToAzure' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VmmToAzure" # type: str class VmmToAzureUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput): @@ -21157,24 +26346,22 @@ class VmmToAzureUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInpu All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VmmToAzureUpdateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'VmmToAzure' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VmmToAzure" # type: str class VmmToVmmCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput): @@ -21182,24 +26369,22 @@ class VmmToVmmCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput) All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VmmToVmmCreateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'VmmToVmm' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VmmToVmm" # type: str class VmmToVmmNetworkMappingSettings(NetworkMappingFabricSpecificSettings): @@ -21207,24 +26392,22 @@ class VmmToVmmNetworkMappingSettings(NetworkMappingFabricSpecificSettings): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the Instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the Instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VmmToVmmNetworkMappingSettings, self).__init__(**kwargs) - self.instance_type = 'VmmToVmm' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VmmToVmm" # type: str class VmmToVmmUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput): @@ -21232,24 +26415,22 @@ class VmmToVmmUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput) All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The instance type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VmmToVmmUpdateNetworkMappingInput, self).__init__(**kwargs) - self.instance_type = 'VmmToVmm' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VmmToVmm" # type: str class VmmVirtualMachineDetails(HyperVVirtualMachineDetails): @@ -21257,45 +26438,48 @@ class VmmVirtualMachineDetails(HyperVVirtualMachineDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param source_item_id: The source id of the object. - :type source_item_id: str - :param generation: The id of the object in fabric. - :type generation: str - :param os_details: The Last replication time. - :type os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :param disk_details: The Last successful failover time. - :type disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - :param has_physical_disk: A value indicating whether the VM has a physical disk attached. - String value of SrsDataContract.PresenceStatus enum. Possible values include: "Unknown", - "Present", "NotPresent". - :type has_physical_disk: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :param has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter - attached. String value of SrsDataContract.PresenceStatus enum. Possible values include: - "Unknown", "Present", "NotPresent". - :type has_fibre_channel_adapter: str or + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar source_item_id: The source id of the object. + :vartype source_item_id: str + :ivar generation: The id of the object in fabric. + :vartype generation: str + :ivar os_details: The Last replication time. + :vartype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails + :ivar disk_details: The Last successful failover time. + :vartype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar has_physical_disk: A value indicating whether the VM has a physical disk attached. String + value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and + "NotPresent". + :vartype has_physical_disk: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :param has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String - value of SrsDataContract.PresenceStatus enum. Possible values include: "Unknown", "Present", + :ivar has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter + attached. String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", + "Present", and "NotPresent". + :vartype has_fibre_channel_adapter: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String value + of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and "NotPresent". - :type has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :vartype has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar hyper_v_host_id: The Id of the hyper-v host in fabric. + :vartype hyper_v_host_id: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'source_item_id': {'key': 'sourceItemId', 'type': 'str'}, - 'generation': {'key': 'generation', 'type': 'str'}, - 'os_details': {'key': 'osDetails', 'type': 'OSDetails'}, - 'disk_details': {'key': 'diskDetails', 'type': '[DiskDetails]'}, - 'has_physical_disk': {'key': 'hasPhysicalDisk', 'type': 'str'}, - 'has_fibre_channel_adapter': {'key': 'hasFibreChannelAdapter', 'type': 'str'}, - 'has_shared_vhd': {'key': 'hasSharedVhd', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "source_item_id": {"key": "sourceItemId", "type": "str"}, + "generation": {"key": "generation", "type": "str"}, + "os_details": {"key": "osDetails", "type": "OSDetails"}, + "disk_details": {"key": "diskDetails", "type": "[DiskDetails]"}, + "has_physical_disk": {"key": "hasPhysicalDisk", "type": "str"}, + "has_fibre_channel_adapter": {"key": "hasFibreChannelAdapter", "type": "str"}, + "has_shared_vhd": {"key": "hasSharedVhd", "type": "str"}, + "hyper_v_host_id": {"key": "hyperVHostId", "type": "str"}, } def __init__( @@ -21303,86 +26487,124 @@ def __init__( *, source_item_id: Optional[str] = None, generation: Optional[str] = None, - os_details: Optional["OSDetails"] = None, - disk_details: Optional[List["DiskDetails"]] = None, - has_physical_disk: Optional[Union[str, "PresenceStatus"]] = None, - has_fibre_channel_adapter: Optional[Union[str, "PresenceStatus"]] = None, - has_shared_vhd: Optional[Union[str, "PresenceStatus"]] = None, - **kwargs - ): - super(VmmVirtualMachineDetails, self).__init__(source_item_id=source_item_id, generation=generation, os_details=os_details, disk_details=disk_details, has_physical_disk=has_physical_disk, has_fibre_channel_adapter=has_fibre_channel_adapter, has_shared_vhd=has_shared_vhd, **kwargs) - self.instance_type = 'VmmVirtualMachine' # type: str - - -class VMNicDetails(msrest.serialization.Model): + os_details: Optional["_models.OSDetails"] = None, + disk_details: Optional[List["_models.DiskDetails"]] = None, + has_physical_disk: Optional[Union[str, "_models.PresenceStatus"]] = None, + has_fibre_channel_adapter: Optional[Union[str, "_models.PresenceStatus"]] = None, + has_shared_vhd: Optional[Union[str, "_models.PresenceStatus"]] = None, + hyper_v_host_id: Optional[str] = None, + **kwargs + ): + """ + :keyword source_item_id: The source id of the object. + :paramtype source_item_id: str + :keyword generation: The id of the object in fabric. + :paramtype generation: str + :keyword os_details: The Last replication time. + :paramtype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails + :keyword disk_details: The Last successful failover time. + :paramtype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :keyword has_physical_disk: A value indicating whether the VM has a physical disk attached. + String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", + and "NotPresent". + :paramtype has_physical_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :keyword has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel + adapter attached. String value of SrsDataContract.PresenceStatus enum. Known values are: + "Unknown", "Present", and "NotPresent". + :paramtype has_fibre_channel_adapter: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :keyword has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String + value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and + "NotPresent". + :paramtype has_shared_vhd: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :keyword hyper_v_host_id: The Id of the hyper-v host in fabric. + :paramtype hyper_v_host_id: str + """ + super().__init__( + source_item_id=source_item_id, + generation=generation, + os_details=os_details, + disk_details=disk_details, + has_physical_disk=has_physical_disk, + has_fibre_channel_adapter=has_fibre_channel_adapter, + has_shared_vhd=has_shared_vhd, + hyper_v_host_id=hyper_v_host_id, + **kwargs + ) + self.instance_type = "VmmVirtualMachine" # type: str + + +class VMNicDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """Hyper V VM network details. - :param nic_id: The nic Id. - :type nic_id: str - :param replica_nic_id: The replica nic Id. - :type replica_nic_id: str - :param source_nic_arm_id: The source nic ARM Id. - :type source_nic_arm_id: str - :param v_m_network_name: VM network name. - :type v_m_network_name: str - :param recovery_vm_network_id: Recovery VM network Id. - :type recovery_vm_network_id: str - :param ip_configs: The IP configurations of the NIC. - :type ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigDetails] - :param selection_type: Selection type for failover. - :type selection_type: str - :param recovery_network_security_group_id: The id of the NSG associated with the NIC. - :type recovery_network_security_group_id: str - :param enable_accelerated_networking_on_recovery: A value indicating whether the NIC has + :ivar nic_id: The nic Id. + :vartype nic_id: str + :ivar replica_nic_id: The replica nic Id. + :vartype replica_nic_id: str + :ivar source_nic_arm_id: The source nic ARM Id. + :vartype source_nic_arm_id: str + :ivar v_m_network_name: VM network name. + :vartype v_m_network_name: str + :ivar recovery_vm_network_id: Recovery VM network Id. + :vartype recovery_vm_network_id: str + :ivar ip_configs: The IP configurations of the NIC. + :vartype ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigDetails] + :ivar selection_type: Selection type for failover. + :vartype selection_type: str + :ivar recovery_network_security_group_id: The id of the NSG associated with the NIC. + :vartype recovery_network_security_group_id: str + :ivar enable_accelerated_networking_on_recovery: A value indicating whether the NIC has accelerated networking enabled. - :type enable_accelerated_networking_on_recovery: bool - :param tfo_vm_network_id: The network to be used by NIC during test failover. - :type tfo_vm_network_id: str - :param tfo_network_security_group_id: The NSG to be used by NIC during test failover. - :type tfo_network_security_group_id: str - :param enable_accelerated_networking_on_tfo: Whether the TFO NIC has accelerated networking + :vartype enable_accelerated_networking_on_recovery: bool + :ivar tfo_vm_network_id: The network to be used by NIC during test failover. + :vartype tfo_vm_network_id: str + :ivar tfo_network_security_group_id: The NSG to be used by NIC during test failover. + :vartype tfo_network_security_group_id: str + :ivar enable_accelerated_networking_on_tfo: Whether the TFO NIC has accelerated networking enabled. - :type enable_accelerated_networking_on_tfo: bool - :param recovery_nic_name: The name of the NIC to be used when creating target NICs. - :type recovery_nic_name: str - :param recovery_nic_resource_group_name: The resource group of the NIC to be used when creating + :vartype enable_accelerated_networking_on_tfo: bool + :ivar recovery_nic_name: The name of the NIC to be used when creating target NICs. + :vartype recovery_nic_name: str + :ivar recovery_nic_resource_group_name: The resource group of the NIC to be used when creating target NICs. - :type recovery_nic_resource_group_name: str - :param reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused + :vartype recovery_nic_resource_group_name: str + :ivar reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. - :type reuse_existing_nic: bool - :param tfo_recovery_nic_name: The name of the NIC to be used when creating target NICs in TFO. - :type tfo_recovery_nic_name: str - :param tfo_recovery_nic_resource_group_name: The resource group of the NIC to be used when + :vartype reuse_existing_nic: bool + :ivar tfo_recovery_nic_name: The name of the NIC to be used when creating target NICs in TFO. + :vartype tfo_recovery_nic_name: str + :ivar tfo_recovery_nic_resource_group_name: The resource group of the NIC to be used when creating target NICs in TFO. - :type tfo_recovery_nic_resource_group_name: str - :param tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be + :vartype tfo_recovery_nic_resource_group_name: str + :ivar tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. - :type tfo_reuse_existing_nic: bool - :param target_nic_name: Target NIC name. - :type target_nic_name: str - """ - - _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'replica_nic_id': {'key': 'replicaNicId', 'type': 'str'}, - 'source_nic_arm_id': {'key': 'sourceNicArmId', 'type': 'str'}, - 'v_m_network_name': {'key': 'vMNetworkName', 'type': 'str'}, - 'recovery_vm_network_id': {'key': 'recoveryVMNetworkId', 'type': 'str'}, - 'ip_configs': {'key': 'ipConfigs', 'type': '[IPConfigDetails]'}, - 'selection_type': {'key': 'selectionType', 'type': 'str'}, - 'recovery_network_security_group_id': {'key': 'recoveryNetworkSecurityGroupId', 'type': 'str'}, - 'enable_accelerated_networking_on_recovery': {'key': 'enableAcceleratedNetworkingOnRecovery', 'type': 'bool'}, - 'tfo_vm_network_id': {'key': 'tfoVMNetworkId', 'type': 'str'}, - 'tfo_network_security_group_id': {'key': 'tfoNetworkSecurityGroupId', 'type': 'str'}, - 'enable_accelerated_networking_on_tfo': {'key': 'enableAcceleratedNetworkingOnTfo', 'type': 'bool'}, - 'recovery_nic_name': {'key': 'recoveryNicName', 'type': 'str'}, - 'recovery_nic_resource_group_name': {'key': 'recoveryNicResourceGroupName', 'type': 'str'}, - 'reuse_existing_nic': {'key': 'reuseExistingNic', 'type': 'bool'}, - 'tfo_recovery_nic_name': {'key': 'tfoRecoveryNicName', 'type': 'str'}, - 'tfo_recovery_nic_resource_group_name': {'key': 'tfoRecoveryNicResourceGroupName', 'type': 'str'}, - 'tfo_reuse_existing_nic': {'key': 'tfoReuseExistingNic', 'type': 'bool'}, - 'target_nic_name': {'key': 'targetNicName', 'type': 'str'}, + :vartype tfo_reuse_existing_nic: bool + :ivar target_nic_name: Target NIC name. + :vartype target_nic_name: str + """ + + _attribute_map = { + "nic_id": {"key": "nicId", "type": "str"}, + "replica_nic_id": {"key": "replicaNicId", "type": "str"}, + "source_nic_arm_id": {"key": "sourceNicArmId", "type": "str"}, + "v_m_network_name": {"key": "vMNetworkName", "type": "str"}, + "recovery_vm_network_id": {"key": "recoveryVMNetworkId", "type": "str"}, + "ip_configs": {"key": "ipConfigs", "type": "[IPConfigDetails]"}, + "selection_type": {"key": "selectionType", "type": "str"}, + "recovery_network_security_group_id": {"key": "recoveryNetworkSecurityGroupId", "type": "str"}, + "enable_accelerated_networking_on_recovery": {"key": "enableAcceleratedNetworkingOnRecovery", "type": "bool"}, + "tfo_vm_network_id": {"key": "tfoVMNetworkId", "type": "str"}, + "tfo_network_security_group_id": {"key": "tfoNetworkSecurityGroupId", "type": "str"}, + "enable_accelerated_networking_on_tfo": {"key": "enableAcceleratedNetworkingOnTfo", "type": "bool"}, + "recovery_nic_name": {"key": "recoveryNicName", "type": "str"}, + "recovery_nic_resource_group_name": {"key": "recoveryNicResourceGroupName", "type": "str"}, + "reuse_existing_nic": {"key": "reuseExistingNic", "type": "bool"}, + "tfo_recovery_nic_name": {"key": "tfoRecoveryNicName", "type": "str"}, + "tfo_recovery_nic_resource_group_name": {"key": "tfoRecoveryNicResourceGroupName", "type": "str"}, + "tfo_reuse_existing_nic": {"key": "tfoReuseExistingNic", "type": "bool"}, + "target_nic_name": {"key": "targetNicName", "type": "str"}, } def __init__( @@ -21393,7 +26615,7 @@ def __init__( source_nic_arm_id: Optional[str] = None, v_m_network_name: Optional[str] = None, recovery_vm_network_id: Optional[str] = None, - ip_configs: Optional[List["IPConfigDetails"]] = None, + ip_configs: Optional[List["_models.IPConfigDetails"]] = None, selection_type: Optional[str] = None, recovery_network_security_group_id: Optional[str] = None, enable_accelerated_networking_on_recovery: Optional[bool] = None, @@ -21402,14 +26624,61 @@ def __init__( enable_accelerated_networking_on_tfo: Optional[bool] = None, recovery_nic_name: Optional[str] = None, recovery_nic_resource_group_name: Optional[str] = None, - reuse_existing_nic: Optional[bool] = False, + reuse_existing_nic: bool = False, tfo_recovery_nic_name: Optional[str] = None, tfo_recovery_nic_resource_group_name: Optional[str] = None, - tfo_reuse_existing_nic: Optional[bool] = False, + tfo_reuse_existing_nic: bool = False, target_nic_name: Optional[str] = None, **kwargs ): - super(VMNicDetails, self).__init__(**kwargs) + """ + :keyword nic_id: The nic Id. + :paramtype nic_id: str + :keyword replica_nic_id: The replica nic Id. + :paramtype replica_nic_id: str + :keyword source_nic_arm_id: The source nic ARM Id. + :paramtype source_nic_arm_id: str + :keyword v_m_network_name: VM network name. + :paramtype v_m_network_name: str + :keyword recovery_vm_network_id: Recovery VM network Id. + :paramtype recovery_vm_network_id: str + :keyword ip_configs: The IP configurations of the NIC. + :paramtype ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigDetails] + :keyword selection_type: Selection type for failover. + :paramtype selection_type: str + :keyword recovery_network_security_group_id: The id of the NSG associated with the NIC. + :paramtype recovery_network_security_group_id: str + :keyword enable_accelerated_networking_on_recovery: A value indicating whether the NIC has + accelerated networking enabled. + :paramtype enable_accelerated_networking_on_recovery: bool + :keyword tfo_vm_network_id: The network to be used by NIC during test failover. + :paramtype tfo_vm_network_id: str + :keyword tfo_network_security_group_id: The NSG to be used by NIC during test failover. + :paramtype tfo_network_security_group_id: str + :keyword enable_accelerated_networking_on_tfo: Whether the TFO NIC has accelerated networking + enabled. + :paramtype enable_accelerated_networking_on_tfo: bool + :keyword recovery_nic_name: The name of the NIC to be used when creating target NICs. + :paramtype recovery_nic_name: str + :keyword recovery_nic_resource_group_name: The resource group of the NIC to be used when + creating target NICs. + :paramtype recovery_nic_resource_group_name: str + :keyword reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused + during failover subject to availability. + :paramtype reuse_existing_nic: bool + :keyword tfo_recovery_nic_name: The name of the NIC to be used when creating target NICs in + TFO. + :paramtype tfo_recovery_nic_name: str + :keyword tfo_recovery_nic_resource_group_name: The resource group of the NIC to be used when + creating target NICs in TFO. + :paramtype tfo_recovery_nic_resource_group_name: str + :keyword tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be + reused during test failover subject to availability. + :paramtype tfo_reuse_existing_nic: bool + :keyword target_nic_name: Target NIC name. + :paramtype target_nic_name: str + """ + super().__init__(**kwargs) self.nic_id = nic_id self.replica_nic_id = replica_nic_id self.source_nic_arm_id = source_nic_arm_id @@ -21431,67 +26700,67 @@ def __init__( self.target_nic_name = target_nic_name -class VMNicInputDetails(msrest.serialization.Model): +class VMNicInputDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """Hyper V VM network input details. - :param nic_id: The nic Id. - :type nic_id: str - :param ip_configs: The IP configurations to be used by NIC during test failover and failover. - :type ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigInputDetails] - :param selection_type: Selection type for failover. - :type selection_type: str - :param recovery_network_security_group_id: The id of the NSG associated with the NIC. - :type recovery_network_security_group_id: str - :param enable_accelerated_networking_on_recovery: Whether the NIC has accelerated networking + :ivar nic_id: The nic Id. + :vartype nic_id: str + :ivar ip_configs: The IP configurations to be used by NIC during test failover and failover. + :vartype ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigInputDetails] + :ivar selection_type: Selection type for failover. + :vartype selection_type: str + :ivar recovery_network_security_group_id: The id of the NSG associated with the NIC. + :vartype recovery_network_security_group_id: str + :ivar enable_accelerated_networking_on_recovery: Whether the NIC has accelerated networking enabled. - :type enable_accelerated_networking_on_recovery: bool - :param tfo_network_security_group_id: The NSG to be used by NIC during test failover. - :type tfo_network_security_group_id: str - :param enable_accelerated_networking_on_tfo: Whether the test NIC has accelerated networking + :vartype enable_accelerated_networking_on_recovery: bool + :ivar tfo_network_security_group_id: The NSG to be used by NIC during test failover. + :vartype tfo_network_security_group_id: str + :ivar enable_accelerated_networking_on_tfo: Whether the test NIC has accelerated networking enabled. - :type enable_accelerated_networking_on_tfo: bool - :param recovery_nic_name: The name of the NIC to be used when creating target NICs. - :type recovery_nic_name: str - :param recovery_nic_resource_group_name: The resource group of the NIC to be used when creating + :vartype enable_accelerated_networking_on_tfo: bool + :ivar recovery_nic_name: The name of the NIC to be used when creating target NICs. + :vartype recovery_nic_name: str + :ivar recovery_nic_resource_group_name: The resource group of the NIC to be used when creating target NICs. - :type recovery_nic_resource_group_name: str - :param reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused + :vartype recovery_nic_resource_group_name: str + :ivar reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. - :type reuse_existing_nic: bool - :param tfo_nic_name: The name of the NIC to be used when creating target NICs in TFO. - :type tfo_nic_name: str - :param tfo_nic_resource_group_name: The resource group of the NIC to be used when creating + :vartype reuse_existing_nic: bool + :ivar tfo_nic_name: The name of the NIC to be used when creating target NICs in TFO. + :vartype tfo_nic_name: str + :ivar tfo_nic_resource_group_name: The resource group of the NIC to be used when creating target NICs in TFO. - :type tfo_nic_resource_group_name: str - :param tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be + :vartype tfo_nic_resource_group_name: str + :ivar tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. - :type tfo_reuse_existing_nic: bool - :param target_nic_name: Target NIC name. - :type target_nic_name: str + :vartype tfo_reuse_existing_nic: bool + :ivar target_nic_name: Target NIC name. + :vartype target_nic_name: str """ _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'ip_configs': {'key': 'ipConfigs', 'type': '[IPConfigInputDetails]'}, - 'selection_type': {'key': 'selectionType', 'type': 'str'}, - 'recovery_network_security_group_id': {'key': 'recoveryNetworkSecurityGroupId', 'type': 'str'}, - 'enable_accelerated_networking_on_recovery': {'key': 'enableAcceleratedNetworkingOnRecovery', 'type': 'bool'}, - 'tfo_network_security_group_id': {'key': 'tfoNetworkSecurityGroupId', 'type': 'str'}, - 'enable_accelerated_networking_on_tfo': {'key': 'enableAcceleratedNetworkingOnTfo', 'type': 'bool'}, - 'recovery_nic_name': {'key': 'recoveryNicName', 'type': 'str'}, - 'recovery_nic_resource_group_name': {'key': 'recoveryNicResourceGroupName', 'type': 'str'}, - 'reuse_existing_nic': {'key': 'reuseExistingNic', 'type': 'bool'}, - 'tfo_nic_name': {'key': 'tfoNicName', 'type': 'str'}, - 'tfo_nic_resource_group_name': {'key': 'tfoNicResourceGroupName', 'type': 'str'}, - 'tfo_reuse_existing_nic': {'key': 'tfoReuseExistingNic', 'type': 'bool'}, - 'target_nic_name': {'key': 'targetNicName', 'type': 'str'}, + "nic_id": {"key": "nicId", "type": "str"}, + "ip_configs": {"key": "ipConfigs", "type": "[IPConfigInputDetails]"}, + "selection_type": {"key": "selectionType", "type": "str"}, + "recovery_network_security_group_id": {"key": "recoveryNetworkSecurityGroupId", "type": "str"}, + "enable_accelerated_networking_on_recovery": {"key": "enableAcceleratedNetworkingOnRecovery", "type": "bool"}, + "tfo_network_security_group_id": {"key": "tfoNetworkSecurityGroupId", "type": "str"}, + "enable_accelerated_networking_on_tfo": {"key": "enableAcceleratedNetworkingOnTfo", "type": "bool"}, + "recovery_nic_name": {"key": "recoveryNicName", "type": "str"}, + "recovery_nic_resource_group_name": {"key": "recoveryNicResourceGroupName", "type": "str"}, + "reuse_existing_nic": {"key": "reuseExistingNic", "type": "bool"}, + "tfo_nic_name": {"key": "tfoNicName", "type": "str"}, + "tfo_nic_resource_group_name": {"key": "tfoNicResourceGroupName", "type": "str"}, + "tfo_reuse_existing_nic": {"key": "tfoReuseExistingNic", "type": "bool"}, + "target_nic_name": {"key": "targetNicName", "type": "str"}, } def __init__( self, *, nic_id: Optional[str] = None, - ip_configs: Optional[List["IPConfigInputDetails"]] = None, + ip_configs: Optional[List["_models.IPConfigInputDetails"]] = None, selection_type: Optional[str] = None, recovery_network_security_group_id: Optional[str] = None, enable_accelerated_networking_on_recovery: Optional[bool] = None, @@ -21506,7 +26775,44 @@ def __init__( target_nic_name: Optional[str] = None, **kwargs ): - super(VMNicInputDetails, self).__init__(**kwargs) + """ + :keyword nic_id: The nic Id. + :paramtype nic_id: str + :keyword ip_configs: The IP configurations to be used by NIC during test failover and failover. + :paramtype ip_configs: + list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigInputDetails] + :keyword selection_type: Selection type for failover. + :paramtype selection_type: str + :keyword recovery_network_security_group_id: The id of the NSG associated with the NIC. + :paramtype recovery_network_security_group_id: str + :keyword enable_accelerated_networking_on_recovery: Whether the NIC has accelerated networking + enabled. + :paramtype enable_accelerated_networking_on_recovery: bool + :keyword tfo_network_security_group_id: The NSG to be used by NIC during test failover. + :paramtype tfo_network_security_group_id: str + :keyword enable_accelerated_networking_on_tfo: Whether the test NIC has accelerated networking + enabled. + :paramtype enable_accelerated_networking_on_tfo: bool + :keyword recovery_nic_name: The name of the NIC to be used when creating target NICs. + :paramtype recovery_nic_name: str + :keyword recovery_nic_resource_group_name: The resource group of the NIC to be used when + creating target NICs. + :paramtype recovery_nic_resource_group_name: str + :keyword reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused + during failover subject to availability. + :paramtype reuse_existing_nic: bool + :keyword tfo_nic_name: The name of the NIC to be used when creating target NICs in TFO. + :paramtype tfo_nic_name: str + :keyword tfo_nic_resource_group_name: The resource group of the NIC to be used when creating + target NICs in TFO. + :paramtype tfo_nic_resource_group_name: str + :keyword tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be + reused during test failover subject to availability. + :paramtype tfo_reuse_existing_nic: bool + :keyword target_nic_name: Target NIC name. + :paramtype target_nic_name: str + """ + super().__init__(**kwargs) self.nic_id = nic_id self.ip_configs = ip_configs self.selection_type = selection_type @@ -21528,37 +26834,40 @@ class VmNicUpdatesTaskDetails(TaskTypeDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The type of task details.Constant filled by server. - :type instance_type: str - :param vm_id: Virtual machine Id. - :type vm_id: str - :param nic_id: Nic Id. - :type nic_id: str - :param name: Name of the Nic. - :type name: str + :ivar instance_type: The type of task details. Required. + :vartype instance_type: str + :ivar vm_id: Virtual machine Id. + :vartype vm_id: str + :ivar nic_id: Nic Id. + :vartype nic_id: str + :ivar name: Name of the Nic. + :vartype name: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "vm_id": {"key": "vmId", "type": "str"}, + "nic_id": {"key": "nicId", "type": "str"}, + "name": {"key": "name", "type": "str"}, } def __init__( - self, - *, - vm_id: Optional[str] = None, - nic_id: Optional[str] = None, - name: Optional[str] = None, - **kwargs + self, *, vm_id: Optional[str] = None, nic_id: Optional[str] = None, name: Optional[str] = None, **kwargs ): - super(VmNicUpdatesTaskDetails, self).__init__(**kwargs) - self.instance_type = 'VmNicUpdatesTaskDetails' # type: str + """ + :keyword vm_id: Virtual machine Id. + :paramtype vm_id: str + :keyword nic_id: Nic Id. + :paramtype nic_id: str + :keyword name: Name of the Nic. + :paramtype name: str + """ + super().__init__(**kwargs) + self.instance_type = "VmNicUpdatesTaskDetails" # type: str self.vm_id = vm_id self.nic_id = nic_id self.name = name @@ -21569,24 +26878,22 @@ class VMwareCbtContainerCreationInput(ReplicationProviderSpecificContainerCreati All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VMwareCbtContainerCreationInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str class VMwareCbtContainerMappingInput(ReplicationProviderSpecificContainerMappingInput): @@ -21594,56 +26901,67 @@ class VMwareCbtContainerMappingInput(ReplicationProviderSpecificContainerMapping All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param key_vault_id: Required. The target key vault ARM Id. - :type key_vault_id: str - :param key_vault_uri: Required. The target key vault URL. - :type key_vault_uri: str - :param storage_account_id: Required. The storage account ARM Id. - :type storage_account_id: str - :param storage_account_sas_secret_name: Required. The secret name of the storage account. - :type storage_account_sas_secret_name: str - :param service_bus_connection_string_secret_name: Required. The secret name of the service bus - connection string. - :type service_bus_connection_string_secret_name: str - :param target_location: Required. The target location. - :type target_location: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar key_vault_id: The target key vault ARM Id. + :vartype key_vault_id: str + :ivar key_vault_uri: The target key vault URL. + :vartype key_vault_uri: str + :ivar storage_account_id: The storage account ARM Id. Required. + :vartype storage_account_id: str + :ivar storage_account_sas_secret_name: The secret name of the storage account. + :vartype storage_account_sas_secret_name: str + :ivar service_bus_connection_string_secret_name: The secret name of the service bus connection + string. + :vartype service_bus_connection_string_secret_name: str + :ivar target_location: The target location. Required. + :vartype target_location: str """ _validation = { - 'instance_type': {'required': True}, - 'key_vault_id': {'required': True}, - 'key_vault_uri': {'required': True}, - 'storage_account_id': {'required': True}, - 'storage_account_sas_secret_name': {'required': True}, - 'service_bus_connection_string_secret_name': {'required': True}, - 'target_location': {'required': True}, + "instance_type": {"required": True}, + "storage_account_id": {"required": True}, + "target_location": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'storage_account_sas_secret_name': {'key': 'storageAccountSasSecretName', 'type': 'str'}, - 'service_bus_connection_string_secret_name': {'key': 'serviceBusConnectionStringSecretName', 'type': 'str'}, - 'target_location': {'key': 'targetLocation', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "key_vault_id": {"key": "keyVaultId", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "storage_account_sas_secret_name": {"key": "storageAccountSasSecretName", "type": "str"}, + "service_bus_connection_string_secret_name": {"key": "serviceBusConnectionStringSecretName", "type": "str"}, + "target_location": {"key": "targetLocation", "type": "str"}, } def __init__( self, *, - key_vault_id: str, - key_vault_uri: str, storage_account_id: str, - storage_account_sas_secret_name: str, - service_bus_connection_string_secret_name: str, target_location: str, - **kwargs - ): - super(VMwareCbtContainerMappingInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + key_vault_id: Optional[str] = None, + key_vault_uri: Optional[str] = None, + storage_account_sas_secret_name: Optional[str] = None, + service_bus_connection_string_secret_name: Optional[str] = None, + **kwargs + ): + """ + :keyword key_vault_id: The target key vault ARM Id. + :paramtype key_vault_id: str + :keyword key_vault_uri: The target key vault URL. + :paramtype key_vault_uri: str + :keyword storage_account_id: The storage account ARM Id. Required. + :paramtype storage_account_id: str + :keyword storage_account_sas_secret_name: The secret name of the storage account. + :paramtype storage_account_sas_secret_name: str + :keyword service_bus_connection_string_secret_name: The secret name of the service bus + connection string. + :paramtype service_bus_connection_string_secret_name: str + :keyword target_location: The target location. Required. + :paramtype target_location: str + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.key_vault_id = key_vault_id self.key_vault_uri = key_vault_uri self.storage_account_id = storage_account_id @@ -21652,41 +26970,41 @@ def __init__( self.target_location = target_location -class VMwareCbtDiskInput(msrest.serialization.Model): +class VMwareCbtDiskInput(_serialization.Model): """VMwareCbt disk input. All required parameters must be populated in order to send to Azure. - :param disk_id: Required. The disk Id. - :type disk_id: str - :param disk_type: The disk type. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :param is_os_disk: Required. A value indicating whether the disk is the OS disk. - :type is_os_disk: str - :param log_storage_account_id: Required. The log storage account ARM Id. - :type log_storage_account_id: str - :param log_storage_account_sas_secret_name: Required. The key vault secret name of the log - storage account. - :type log_storage_account_sas_secret_name: str - :param disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :type disk_encryption_set_id: str + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar is_os_disk: A value indicating whether the disk is the OS disk. Required. + :vartype is_os_disk: str + :ivar log_storage_account_id: The log storage account ARM Id. Required. + :vartype log_storage_account_id: str + :ivar log_storage_account_sas_secret_name: The key vault secret name of the log storage + account. Required. + :vartype log_storage_account_sas_secret_name: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str """ _validation = { - 'disk_id': {'required': True}, - 'is_os_disk': {'required': True}, - 'log_storage_account_id': {'required': True}, - 'log_storage_account_sas_secret_name': {'required': True}, + "disk_id": {"required": True}, + "is_os_disk": {"required": True}, + "log_storage_account_id": {"required": True}, + "log_storage_account_sas_secret_name": {"required": True}, } _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'log_storage_account_sas_secret_name': {'key': 'logStorageAccountSasSecretName', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "is_os_disk": {"key": "isOSDisk", "type": "str"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "log_storage_account_sas_secret_name": {"key": "logStorageAccountSasSecretName", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, } def __init__( @@ -21696,11 +27014,27 @@ def __init__( is_os_disk: str, log_storage_account_id: str, log_storage_account_sas_secret_name: str, - disk_type: Optional[Union[str, "DiskAccountType"]] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, disk_encryption_set_id: Optional[str] = None, **kwargs ): - super(VMwareCbtDiskInput, self).__init__(**kwargs) + """ + :keyword disk_id: The disk Id. Required. + :paramtype disk_id: str + :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", and + "StandardSSD_LRS". + :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :keyword is_os_disk: A value indicating whether the disk is the OS disk. Required. + :paramtype is_os_disk: str + :keyword log_storage_account_id: The log storage account ARM Id. Required. + :paramtype log_storage_account_id: str + :keyword log_storage_account_sas_secret_name: The key vault secret name of the log storage + account. Required. + :paramtype log_storage_account_sas_secret_name: str + :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :paramtype disk_encryption_set_id: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.disk_type = disk_type self.is_os_disk = is_os_disk @@ -21709,108 +27043,123 @@ def __init__( self.disk_encryption_set_id = disk_encryption_set_id -class VMwareCbtEnableMigrationInput(EnableMigrationProviderSpecificInput): +class VMwareCbtEnableMigrationInput( + EnableMigrationProviderSpecificInput +): # pylint: disable=too-many-instance-attributes """VMwareCbt specific enable migration input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param vmware_machine_id: Required. The ARM Id of the VM discovered in VMware. - :type vmware_machine_id: str - :param disks_to_include: Required. The disks to include list. - :type disks_to_include: + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar vmware_machine_id: The ARM Id of the VM discovered in VMware. Required. + :vartype vmware_machine_id: str + :ivar disks_to_include: The disks to include list. Required. + :vartype disks_to_include: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtDiskInput] - :param license_type: License type. Possible values include: "NotSpecified", "NoLicenseType", + :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param data_mover_run_as_account_id: Required. The data mover run as account Id. - :type data_mover_run_as_account_id: str - :param snapshot_run_as_account_id: Required. The snapshot run as account Id. - :type snapshot_run_as_account_id: str - :param target_vm_name: The target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_resource_group_id: Required. The target resource group ARM Id. - :type target_resource_group_id: str - :param target_network_id: Required. The target network ARM Id. - :type target_network_id: str - :param target_subnet_name: The target subnet name. - :type target_subnet_name: str - :param target_availability_set_id: The target availability set ARM Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group ARM Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + :ivar perform_sql_bulk_registration: A value indicating whether bulk SQL RP registration to be + done. + :vartype perform_sql_bulk_registration: str + :ivar data_mover_run_as_account_id: The data mover run as account Id. Required. + :vartype data_mover_run_as_account_id: str + :ivar snapshot_run_as_account_id: The snapshot run as account Id. Required. + :vartype snapshot_run_as_account_id: str + :ivar target_vm_name: The target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_resource_group_id: The target resource group ARM Id. Required. + :vartype target_resource_group_id: str + :ivar target_network_id: The target network ARM Id. Required. + :vartype target_network_id: str + :ivar test_network_id: The selected test network ARM Id. + :vartype test_network_id: str + :ivar target_subnet_name: The target subnet name. + :vartype target_subnet_name: str + :ivar test_subnet_name: The selected test subnet name. + :vartype test_subnet_name: str + :ivar target_availability_set_id: The target availability set ARM Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group ARM Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param perform_auto_resync: A value indicating whether auto resync is to be done. - :type perform_auto_resync: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param seed_disk_tags: The tags for the seed disks. - :type seed_disk_tags: dict[str, str] - :param target_disk_tags: The tags for the target disks. - :type target_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - 'vmware_machine_id': {'required': True}, - 'disks_to_include': {'required': True}, - 'data_mover_run_as_account_id': {'required': True}, - 'snapshot_run_as_account_id': {'required': True}, - 'target_resource_group_id': {'required': True}, - 'target_network_id': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_machine_id': {'key': 'vmwareMachineId', 'type': 'str'}, - 'disks_to_include': {'key': 'disksToInclude', 'type': '[VMwareCbtDiskInput]'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'data_mover_run_as_account_id': {'key': 'dataMoverRunAsAccountId', 'type': 'str'}, - 'snapshot_run_as_account_id': {'key': 'snapshotRunAsAccountId', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'perform_auto_resync': {'key': 'performAutoResync', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'seed_disk_tags': {'key': 'seedDiskTags', 'type': '{str}'}, - 'target_disk_tags': {'key': 'targetDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - } - - def __init__( + :vartype target_boot_diagnostics_storage_account_id: str + :ivar perform_auto_resync: A value indicating whether auto resync is to be done. + :vartype perform_auto_resync: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_disk_tags: The tags for the seed disks. + :vartype seed_disk_tags: dict[str, str] + :ivar target_disk_tags: The tags for the target disks. + :vartype target_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + """ + + _validation = { + "instance_type": {"required": True}, + "vmware_machine_id": {"required": True}, + "disks_to_include": {"required": True}, + "data_mover_run_as_account_id": {"required": True}, + "snapshot_run_as_account_id": {"required": True}, + "target_resource_group_id": {"required": True}, + "target_network_id": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "vmware_machine_id": {"key": "vmwareMachineId", "type": "str"}, + "disks_to_include": {"key": "disksToInclude", "type": "[VMwareCbtDiskInput]"}, + "license_type": {"key": "licenseType", "type": "str"}, + "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, + "perform_sql_bulk_registration": {"key": "performSqlBulkRegistration", "type": "str"}, + "data_mover_run_as_account_id": {"key": "dataMoverRunAsAccountId", "type": "str"}, + "snapshot_run_as_account_id": {"key": "snapshotRunAsAccountId", "type": "str"}, + "target_vm_name": {"key": "targetVmName", "type": "str"}, + "target_vm_size": {"key": "targetVmSize", "type": "str"}, + "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, + "target_network_id": {"key": "targetNetworkId", "type": "str"}, + "test_network_id": {"key": "testNetworkId", "type": "str"}, + "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, + "test_subnet_name": {"key": "testSubnetName", "type": "str"}, + "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, + "perform_auto_resync": {"key": "performAutoResync", "type": "str"}, + "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, + "seed_disk_tags": {"key": "seedDiskTags", "type": "{str}"}, + "target_disk_tags": {"key": "targetDiskTags", "type": "{str}"}, + "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, vmware_machine_id: str, - disks_to_include: List["VMwareCbtDiskInput"], + disks_to_include: List["_models.VMwareCbtDiskInput"], data_mover_run_as_account_id: str, snapshot_run_as_account_id: str, target_resource_group_id: str, target_network_id: str, - license_type: Optional[Union[str, "LicenseType"]] = None, - sql_server_license_type: Optional[Union[str, "SqlServerLicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + perform_sql_bulk_registration: Optional[str] = None, target_vm_name: Optional[str] = None, target_vm_size: Optional[str] = None, + test_network_id: Optional[str] = None, target_subnet_name: Optional[str] = None, + test_subnet_name: Optional[str] = None, target_availability_set_id: Optional[str] = None, target_availability_zone: Optional[str] = None, target_proximity_placement_group_id: Optional[str] = None, @@ -21822,19 +27171,76 @@ def __init__( target_nic_tags: Optional[Dict[str, str]] = None, **kwargs ): - super(VMwareCbtEnableMigrationInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + """ + :keyword vmware_machine_id: The ARM Id of the VM discovered in VMware. Required. + :paramtype vmware_machine_id: str + :keyword disks_to_include: The disks to include list. Required. + :paramtype disks_to_include: + list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtDiskInput] + :keyword license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :keyword sql_server_license_type: The SQL Server license type. Known values are: + "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". + :paramtype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :keyword perform_sql_bulk_registration: A value indicating whether bulk SQL RP registration to + be done. + :paramtype perform_sql_bulk_registration: str + :keyword data_mover_run_as_account_id: The data mover run as account Id. Required. + :paramtype data_mover_run_as_account_id: str + :keyword snapshot_run_as_account_id: The snapshot run as account Id. Required. + :paramtype snapshot_run_as_account_id: str + :keyword target_vm_name: The target VM name. + :paramtype target_vm_name: str + :keyword target_vm_size: The target VM size. + :paramtype target_vm_size: str + :keyword target_resource_group_id: The target resource group ARM Id. Required. + :paramtype target_resource_group_id: str + :keyword target_network_id: The target network ARM Id. Required. + :paramtype target_network_id: str + :keyword test_network_id: The selected test network ARM Id. + :paramtype test_network_id: str + :keyword target_subnet_name: The target subnet name. + :paramtype target_subnet_name: str + :keyword test_subnet_name: The selected test subnet name. + :paramtype test_subnet_name: str + :keyword target_availability_set_id: The target availability set ARM Id. + :paramtype target_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_proximity_placement_group_id: The target proximity placement group ARM Id. + :paramtype target_proximity_placement_group_id: str + :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage + account ARM Id. + :paramtype target_boot_diagnostics_storage_account_id: str + :keyword perform_auto_resync: A value indicating whether auto resync is to be done. + :paramtype perform_auto_resync: str + :keyword target_vm_tags: The target VM tags. + :paramtype target_vm_tags: dict[str, str] + :keyword seed_disk_tags: The tags for the seed disks. + :paramtype seed_disk_tags: dict[str, str] + :keyword target_disk_tags: The tags for the target disks. + :paramtype target_disk_tags: dict[str, str] + :keyword target_nic_tags: The tags for the target NICs. + :paramtype target_nic_tags: dict[str, str] + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.vmware_machine_id = vmware_machine_id self.disks_to_include = disks_to_include self.license_type = license_type self.sql_server_license_type = sql_server_license_type + self.perform_sql_bulk_registration = perform_sql_bulk_registration self.data_mover_run_as_account_id = data_mover_run_as_account_id self.snapshot_run_as_account_id = snapshot_run_as_account_id self.target_vm_name = target_vm_name self.target_vm_size = target_vm_size self.target_resource_group_id = target_resource_group_id self.target_network_id = target_network_id + self.test_network_id = test_network_id self.target_subnet_name = target_subnet_name + self.test_subnet_name = test_subnet_name self.target_availability_set_id = target_availability_set_id self.target_availability_zone = target_availability_zone self.target_proximity_placement_group_id = target_proximity_placement_group_id @@ -21853,29 +27259,26 @@ class VMwareCbtEventDetails(EventProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str :ivar migration_item_name: The migration item name. :vartype migration_item_name: str """ _validation = { - 'instance_type': {'required': True}, - 'migration_item_name': {'readonly': True}, + "instance_type": {"required": True}, + "migration_item_name": {"readonly": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'migration_item_name': {'key': 'migrationItemName', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "migration_item_name": {"key": "migrationItemName", "type": "str"}, } - def __init__( - self, - **kwargs - ): - super(VMwareCbtEventDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.migration_item_name = None @@ -21884,42 +27287,41 @@ class VMwareCbtMigrateInput(MigrateProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param perform_shutdown: Required. A value indicating whether VM is to be shutdown. - :type perform_shutdown: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar perform_shutdown: A value indicating whether VM is to be shutdown. Required. + :vartype perform_shutdown: str """ _validation = { - 'instance_type': {'required': True}, - 'perform_shutdown': {'required': True}, + "instance_type": {"required": True}, + "perform_shutdown": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'perform_shutdown': {'key': 'performShutdown', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "perform_shutdown": {"key": "performShutdown", "type": "str"}, } - def __init__( - self, - *, - perform_shutdown: str, - **kwargs - ): - super(VMwareCbtMigrateInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + def __init__(self, *, perform_shutdown: str, **kwargs): + """ + :keyword perform_shutdown: A value indicating whether VM is to be shutdown. Required. + :paramtype perform_shutdown: str + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.perform_shutdown = perform_shutdown -class VMwareCbtMigrationDetails(MigrationProviderSpecificSettings): +class VMwareCbtMigrationDetails(MigrationProviderSpecificSettings): # pylint: disable=too-many-instance-attributes """VMwareCbt provider specific settings. 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. - :param instance_type: Required. Gets the instance type.Constant filled by server. - :type instance_type: str + :ivar instance_type: Gets the instance type. Required. + :vartype instance_type: str :ivar vmware_machine_id: The ARM Id of the VM discovered in VMware. :vartype vmware_machine_id: str :ivar os_type: The type of the OS on the VM. @@ -21928,42 +27330,47 @@ class VMwareCbtMigrationDetails(MigrationProviderSpecificSettings): :vartype firmware_type: str :ivar target_generation: The target generation. :vartype target_generation: str - :param license_type: License Type of the VM to be used. - :type license_type: str - :param sql_server_license_type: The SQL Server license type. - :type sql_server_license_type: str + :ivar license_type: License Type of the VM to be used. + :vartype license_type: str + :ivar sql_server_license_type: The SQL Server license type. + :vartype sql_server_license_type: str :ivar data_mover_run_as_account_id: The data mover run as account Id. :vartype data_mover_run_as_account_id: str :ivar snapshot_run_as_account_id: The snapshot run as account Id. :vartype snapshot_run_as_account_id: str - :param target_vm_name: Target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str + :ivar storage_account_id: The replication storage account ARM Id. This is applicable only for + the blob based replication test hook. + :vartype storage_account_id: str + :ivar target_vm_name: Target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str :ivar target_location: The target location. :vartype target_location: str - :param target_resource_group_id: The target resource group Id. - :type target_resource_group_id: str - :param target_availability_set_id: The target availability set Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + :ivar target_resource_group_id: The target resource group Id. + :vartype target_resource_group_id: str + :ivar target_availability_set_id: The target availability set Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param protected_disks: The list of protected disks. - :type protected_disks: + :vartype target_boot_diagnostics_storage_account_id: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtProtectedDiskDetails] - :param target_network_id: The target network Id. - :type target_network_id: str - :param vm_nics: The network details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicDetails] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] + :ivar target_network_id: The target network Id. + :vartype target_network_id: str + :ivar test_network_id: The test network Id. + :vartype test_network_id: str + :ivar vm_nics: The network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicDetails] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] :ivar migration_recovery_point_id: The recovery point Id to which the VM was migrated. :vartype migration_recovery_point_id: str :ivar last_recovery_point_received: The last recovery point received time. @@ -21976,83 +27383,94 @@ class VMwareCbtMigrationDetails(MigrationProviderSpecificSettings): :vartype migration_progress_percentage: int :ivar resync_progress_percentage: The resync progress percentage. :vartype resync_progress_percentage: int + :ivar resume_progress_percentage: The resume progress percentage. + :vartype resume_progress_percentage: int :ivar initial_seeding_retry_count: The initial seeding retry count. - :vartype initial_seeding_retry_count: long + :vartype initial_seeding_retry_count: int :ivar resync_retry_count: The resync retry count. - :vartype resync_retry_count: long + :vartype resync_retry_count: int + :ivar resume_retry_count: The resume retry count. + :vartype resume_retry_count: int :ivar resync_required: A value indicating whether resync is required. :vartype resync_required: str - :ivar resync_state: The resync state. Possible values include: "None", - "PreparedForResynchronization", "StartedResynchronization". + :ivar resync_state: The resync state. Known values are: "None", "PreparedForResynchronization", + and "StartedResynchronization". :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState - :param perform_auto_resync: A value indicating whether auto resync is to be done. - :type perform_auto_resync: str - :param seed_disk_tags: The tags for the seed disks. - :type seed_disk_tags: dict[str, str] - :param target_disk_tags: The tags for the target disks. - :type target_disk_tags: dict[str, str] - """ - - _validation = { - 'instance_type': {'required': True}, - 'vmware_machine_id': {'readonly': True}, - 'os_type': {'readonly': True}, - 'firmware_type': {'readonly': True}, - 'target_generation': {'readonly': True}, - 'data_mover_run_as_account_id': {'readonly': True}, - 'snapshot_run_as_account_id': {'readonly': True}, - 'target_location': {'readonly': True}, - 'migration_recovery_point_id': {'readonly': True}, - 'last_recovery_point_received': {'readonly': True}, - 'last_recovery_point_id': {'readonly': True}, - 'initial_seeding_progress_percentage': {'readonly': True}, - 'migration_progress_percentage': {'readonly': True}, - 'resync_progress_percentage': {'readonly': True}, - 'initial_seeding_retry_count': {'readonly': True}, - 'resync_retry_count': {'readonly': True}, - 'resync_required': {'readonly': True}, - 'resync_state': {'readonly': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_machine_id': {'key': 'vmwareMachineId', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'firmware_type': {'key': 'firmwareType', 'type': 'str'}, - 'target_generation': {'key': 'targetGeneration', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'data_mover_run_as_account_id': {'key': 'dataMoverRunAsAccountId', 'type': 'str'}, - 'snapshot_run_as_account_id': {'key': 'snapshotRunAsAccountId', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_location': {'key': 'targetLocation', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'protected_disks': {'key': 'protectedDisks', 'type': '[VMwareCbtProtectedDiskDetails]'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMwareCbtNicDetails]'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, - 'migration_recovery_point_id': {'key': 'migrationRecoveryPointId', 'type': 'str'}, - 'last_recovery_point_received': {'key': 'lastRecoveryPointReceived', 'type': 'iso-8601'}, - 'last_recovery_point_id': {'key': 'lastRecoveryPointId', 'type': 'str'}, - 'initial_seeding_progress_percentage': {'key': 'initialSeedingProgressPercentage', 'type': 'int'}, - 'migration_progress_percentage': {'key': 'migrationProgressPercentage', 'type': 'int'}, - 'resync_progress_percentage': {'key': 'resyncProgressPercentage', 'type': 'int'}, - 'initial_seeding_retry_count': {'key': 'initialSeedingRetryCount', 'type': 'long'}, - 'resync_retry_count': {'key': 'resyncRetryCount', 'type': 'long'}, - 'resync_required': {'key': 'resyncRequired', 'type': 'str'}, - 'resync_state': {'key': 'resyncState', 'type': 'str'}, - 'perform_auto_resync': {'key': 'performAutoResync', 'type': 'str'}, - 'seed_disk_tags': {'key': 'seedDiskTags', 'type': '{str}'}, - 'target_disk_tags': {'key': 'targetDiskTags', 'type': '{str}'}, - } - - def __init__( + :ivar perform_auto_resync: A value indicating whether auto resync is to be done. + :vartype perform_auto_resync: str + :ivar seed_disk_tags: The tags for the seed disks. + :vartype seed_disk_tags: dict[str, str] + :ivar target_disk_tags: The tags for the target disks. + :vartype target_disk_tags: dict[str, str] + """ + + _validation = { + "instance_type": {"required": True}, + "vmware_machine_id": {"readonly": True}, + "os_type": {"readonly": True}, + "firmware_type": {"readonly": True}, + "target_generation": {"readonly": True}, + "data_mover_run_as_account_id": {"readonly": True}, + "snapshot_run_as_account_id": {"readonly": True}, + "storage_account_id": {"readonly": True}, + "target_location": {"readonly": True}, + "migration_recovery_point_id": {"readonly": True}, + "last_recovery_point_received": {"readonly": True}, + "last_recovery_point_id": {"readonly": True}, + "initial_seeding_progress_percentage": {"readonly": True}, + "migration_progress_percentage": {"readonly": True}, + "resync_progress_percentage": {"readonly": True}, + "resume_progress_percentage": {"readonly": True}, + "initial_seeding_retry_count": {"readonly": True}, + "resync_retry_count": {"readonly": True}, + "resume_retry_count": {"readonly": True}, + "resync_required": {"readonly": True}, + "resync_state": {"readonly": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "vmware_machine_id": {"key": "vmwareMachineId", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "firmware_type": {"key": "firmwareType", "type": "str"}, + "target_generation": {"key": "targetGeneration", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, + "data_mover_run_as_account_id": {"key": "dataMoverRunAsAccountId", "type": "str"}, + "snapshot_run_as_account_id": {"key": "snapshotRunAsAccountId", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "target_vm_name": {"key": "targetVmName", "type": "str"}, + "target_vm_size": {"key": "targetVmSize", "type": "str"}, + "target_location": {"key": "targetLocation", "type": "str"}, + "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, + "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, + "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, + "protected_disks": {"key": "protectedDisks", "type": "[VMwareCbtProtectedDiskDetails]"}, + "target_network_id": {"key": "targetNetworkId", "type": "str"}, + "test_network_id": {"key": "testNetworkId", "type": "str"}, + "vm_nics": {"key": "vmNics", "type": "[VMwareCbtNicDetails]"}, + "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, + "migration_recovery_point_id": {"key": "migrationRecoveryPointId", "type": "str"}, + "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, + "last_recovery_point_id": {"key": "lastRecoveryPointId", "type": "str"}, + "initial_seeding_progress_percentage": {"key": "initialSeedingProgressPercentage", "type": "int"}, + "migration_progress_percentage": {"key": "migrationProgressPercentage", "type": "int"}, + "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, + "resume_progress_percentage": {"key": "resumeProgressPercentage", "type": "int"}, + "initial_seeding_retry_count": {"key": "initialSeedingRetryCount", "type": "int"}, + "resync_retry_count": {"key": "resyncRetryCount", "type": "int"}, + "resume_retry_count": {"key": "resumeRetryCount", "type": "int"}, + "resync_required": {"key": "resyncRequired", "type": "str"}, + "resync_state": {"key": "resyncState", "type": "str"}, + "perform_auto_resync": {"key": "performAutoResync", "type": "str"}, + "seed_disk_tags": {"key": "seedDiskTags", "type": "{str}"}, + "target_disk_tags": {"key": "targetDiskTags", "type": "{str}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, license_type: Optional[str] = None, @@ -22065,17 +27483,58 @@ def __init__( target_proximity_placement_group_id: Optional[str] = None, target_boot_diagnostics_storage_account_id: Optional[str] = None, target_vm_tags: Optional[Dict[str, str]] = None, - protected_disks: Optional[List["VMwareCbtProtectedDiskDetails"]] = None, + protected_disks: Optional[List["_models.VMwareCbtProtectedDiskDetails"]] = None, target_network_id: Optional[str] = None, - vm_nics: Optional[List["VMwareCbtNicDetails"]] = None, + test_network_id: Optional[str] = None, + vm_nics: Optional[List["_models.VMwareCbtNicDetails"]] = None, target_nic_tags: Optional[Dict[str, str]] = None, perform_auto_resync: Optional[str] = None, seed_disk_tags: Optional[Dict[str, str]] = None, target_disk_tags: Optional[Dict[str, str]] = None, **kwargs ): - super(VMwareCbtMigrationDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + """ + :keyword license_type: License Type of the VM to be used. + :paramtype license_type: str + :keyword sql_server_license_type: The SQL Server license type. + :paramtype sql_server_license_type: str + :keyword target_vm_name: Target VM name. + :paramtype target_vm_name: str + :keyword target_vm_size: The target VM size. + :paramtype target_vm_size: str + :keyword target_resource_group_id: The target resource group Id. + :paramtype target_resource_group_id: str + :keyword target_availability_set_id: The target availability set Id. + :paramtype target_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_proximity_placement_group_id: The target proximity placement group Id. + :paramtype target_proximity_placement_group_id: str + :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage + account ARM Id. + :paramtype target_boot_diagnostics_storage_account_id: str + :keyword target_vm_tags: The target VM tags. + :paramtype target_vm_tags: dict[str, str] + :keyword protected_disks: The list of protected disks. + :paramtype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtProtectedDiskDetails] + :keyword target_network_id: The target network Id. + :paramtype target_network_id: str + :keyword test_network_id: The test network Id. + :paramtype test_network_id: str + :keyword vm_nics: The network details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicDetails] + :keyword target_nic_tags: The tags for the target NICs. + :paramtype target_nic_tags: dict[str, str] + :keyword perform_auto_resync: A value indicating whether auto resync is to be done. + :paramtype perform_auto_resync: str + :keyword seed_disk_tags: The tags for the seed disks. + :paramtype seed_disk_tags: dict[str, str] + :keyword target_disk_tags: The tags for the target disks. + :paramtype target_disk_tags: dict[str, str] + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.vmware_machine_id = None self.os_type = None self.firmware_type = None @@ -22084,6 +27543,7 @@ def __init__( self.sql_server_license_type = sql_server_license_type self.data_mover_run_as_account_id = None self.snapshot_run_as_account_id = None + self.storage_account_id = None self.target_vm_name = target_vm_name self.target_vm_size = target_vm_size self.target_location = None @@ -22095,6 +27555,7 @@ def __init__( self.target_vm_tags = target_vm_tags self.protected_disks = protected_disks self.target_network_id = target_network_id + self.test_network_id = test_network_id self.vm_nics = vm_nics self.target_nic_tags = target_nic_tags self.migration_recovery_point_id = None @@ -22103,8 +27564,10 @@ def __init__( self.initial_seeding_progress_percentage = None self.migration_progress_percentage = None self.resync_progress_percentage = None + self.resume_progress_percentage = None self.initial_seeding_retry_count = None self.resync_retry_count = None + self.resume_retry_count = None self.resync_required = None self.resync_state = None self.perform_auto_resync = perform_auto_resync @@ -22112,56 +27575,68 @@ def __init__( self.target_disk_tags = target_disk_tags -class VMwareCbtNicDetails(msrest.serialization.Model): +class VMwareCbtNicDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """VMwareCbt NIC details. Variables are only populated by the server, and will be ignored when sending a request. :ivar nic_id: The NIC Id. :vartype nic_id: str - :param is_primary_nic: A value indicating whether this is the primary NIC. - :type is_primary_nic: str + :ivar is_primary_nic: A value indicating whether this is the primary NIC. + :vartype is_primary_nic: str :ivar source_ip_address: The source IP address. :vartype source_ip_address: str - :ivar source_ip_address_type: The source IP address type. Possible values include: "Dynamic", + :ivar source_ip_address_type: The source IP address type. Known values are: "Dynamic" and "Static". :vartype source_ip_address_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType :ivar source_network_id: Source network Id. :vartype source_network_id: str - :param target_ip_address: The target IP address. - :type target_ip_address: str - :param target_ip_address_type: The target IP address type. Possible values include: "Dynamic", + :ivar target_ip_address: The target IP address. + :vartype target_ip_address: str + :ivar target_ip_address_type: The target IP address type. Known values are: "Dynamic" and "Static". - :type target_ip_address_type: str or + :vartype target_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :ivar target_subnet_name: Target subnet name. + :vartype target_subnet_name: str + :ivar test_network_id: Source network Id. + :vartype test_network_id: str + :ivar test_subnet_name: Test subnet name. + :vartype test_subnet_name: str + :ivar test_ip_address: The test IP address. + :vartype test_ip_address: str + :ivar test_ip_address_type: The test IP address type. Known values are: "Dynamic" and "Static". + :vartype test_ip_address_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :param target_subnet_name: Target subnet name. - :type target_subnet_name: str - :param target_nic_name: Target NIC name. - :type target_nic_name: str - :param is_selected_for_migration: A value indicating whether this NIC is selected for - migration. - :type is_selected_for_migration: str + :ivar target_nic_name: Target NIC name. + :vartype target_nic_name: str + :ivar is_selected_for_migration: A value indicating whether this NIC is selected for migration. + :vartype is_selected_for_migration: str """ _validation = { - 'nic_id': {'readonly': True}, - 'source_ip_address': {'readonly': True}, - 'source_ip_address_type': {'readonly': True}, - 'source_network_id': {'readonly': True}, + "nic_id": {"readonly": True}, + "source_ip_address": {"readonly": True}, + "source_ip_address_type": {"readonly": True}, + "source_network_id": {"readonly": True}, } _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'is_primary_nic': {'key': 'isPrimaryNic', 'type': 'str'}, - 'source_ip_address': {'key': 'sourceIPAddress', 'type': 'str'}, - 'source_ip_address_type': {'key': 'sourceIPAddressType', 'type': 'str'}, - 'source_network_id': {'key': 'sourceNetworkId', 'type': 'str'}, - 'target_ip_address': {'key': 'targetIPAddress', 'type': 'str'}, - 'target_ip_address_type': {'key': 'targetIPAddressType', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'target_nic_name': {'key': 'targetNicName', 'type': 'str'}, - 'is_selected_for_migration': {'key': 'isSelectedForMigration', 'type': 'str'}, + "nic_id": {"key": "nicId", "type": "str"}, + "is_primary_nic": {"key": "isPrimaryNic", "type": "str"}, + "source_ip_address": {"key": "sourceIPAddress", "type": "str"}, + "source_ip_address_type": {"key": "sourceIPAddressType", "type": "str"}, + "source_network_id": {"key": "sourceNetworkId", "type": "str"}, + "target_ip_address": {"key": "targetIPAddress", "type": "str"}, + "target_ip_address_type": {"key": "targetIPAddressType", "type": "str"}, + "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, + "test_network_id": {"key": "testNetworkId", "type": "str"}, + "test_subnet_name": {"key": "testSubnetName", "type": "str"}, + "test_ip_address": {"key": "testIPAddress", "type": "str"}, + "test_ip_address_type": {"key": "testIPAddressType", "type": "str"}, + "target_nic_name": {"key": "targetNicName", "type": "str"}, + "is_selected_for_migration": {"key": "isSelectedForMigration", "type": "str"}, } def __init__( @@ -22169,13 +27644,44 @@ def __init__( *, is_primary_nic: Optional[str] = None, target_ip_address: Optional[str] = None, - target_ip_address_type: Optional[Union[str, "EthernetAddressType"]] = None, + target_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, target_subnet_name: Optional[str] = None, + test_network_id: Optional[str] = None, + test_subnet_name: Optional[str] = None, + test_ip_address: Optional[str] = None, + test_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, target_nic_name: Optional[str] = None, is_selected_for_migration: Optional[str] = None, **kwargs ): - super(VMwareCbtNicDetails, self).__init__(**kwargs) + """ + :keyword is_primary_nic: A value indicating whether this is the primary NIC. + :paramtype is_primary_nic: str + :keyword target_ip_address: The target IP address. + :paramtype target_ip_address: str + :keyword target_ip_address_type: The target IP address type. Known values are: "Dynamic" and + "Static". + :paramtype target_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :keyword target_subnet_name: Target subnet name. + :paramtype target_subnet_name: str + :keyword test_network_id: Source network Id. + :paramtype test_network_id: str + :keyword test_subnet_name: Test subnet name. + :paramtype test_subnet_name: str + :keyword test_ip_address: The test IP address. + :paramtype test_ip_address: str + :keyword test_ip_address_type: The test IP address type. Known values are: "Dynamic" and + "Static". + :paramtype test_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :keyword target_nic_name: Target NIC name. + :paramtype target_nic_name: str + :keyword is_selected_for_migration: A value indicating whether this NIC is selected for + migration. + :paramtype is_selected_for_migration: str + """ + super().__init__(**kwargs) self.nic_id = None self.is_primary_nic = is_primary_nic self.source_ip_address = None @@ -22184,42 +27690,51 @@ def __init__( self.target_ip_address = target_ip_address self.target_ip_address_type = target_ip_address_type self.target_subnet_name = target_subnet_name + self.test_network_id = test_network_id + self.test_subnet_name = test_subnet_name + self.test_ip_address = test_ip_address + self.test_ip_address_type = test_ip_address_type self.target_nic_name = target_nic_name self.is_selected_for_migration = is_selected_for_migration -class VMwareCbtNicInput(msrest.serialization.Model): +class VMwareCbtNicInput(_serialization.Model): """VMwareCbt NIC input. All required parameters must be populated in order to send to Azure. - :param nic_id: Required. The NIC Id. - :type nic_id: str - :param is_primary_nic: Required. A value indicating whether this is the primary NIC. - :type is_primary_nic: str - :param target_subnet_name: Target subnet name. - :type target_subnet_name: str - :param target_static_ip_address: The static IP address. - :type target_static_ip_address: str - :param is_selected_for_migration: A value indicating whether this NIC is selected for - migration. - :type is_selected_for_migration: str - :param target_nic_name: Target NIC name. - :type target_nic_name: str + :ivar nic_id: The NIC Id. Required. + :vartype nic_id: str + :ivar is_primary_nic: A value indicating whether this is the primary NIC. Required. + :vartype is_primary_nic: str + :ivar target_subnet_name: Target subnet name. + :vartype target_subnet_name: str + :ivar target_static_ip_address: The static IP address. + :vartype target_static_ip_address: str + :ivar is_selected_for_migration: A value indicating whether this NIC is selected for migration. + :vartype is_selected_for_migration: str + :ivar target_nic_name: Target NIC name. + :vartype target_nic_name: str + :ivar test_subnet_name: The test subnet name. + :vartype test_subnet_name: str + :ivar test_static_ip_address: The test static IP address. + :vartype test_static_ip_address: str """ _validation = { - 'nic_id': {'required': True}, - 'is_primary_nic': {'required': True}, + "nic_id": {"required": True}, + "is_primary_nic": {"required": True}, } _attribute_map = { - 'nic_id': {'key': 'nicId', 'type': 'str'}, - 'is_primary_nic': {'key': 'isPrimaryNic', 'type': 'str'}, - 'target_subnet_name': {'key': 'targetSubnetName', 'type': 'str'}, - 'target_static_ip_address': {'key': 'targetStaticIPAddress', 'type': 'str'}, - 'is_selected_for_migration': {'key': 'isSelectedForMigration', 'type': 'str'}, - 'target_nic_name': {'key': 'targetNicName', 'type': 'str'}, + "nic_id": {"key": "nicId", "type": "str"}, + "is_primary_nic": {"key": "isPrimaryNic", "type": "str"}, + "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, + "target_static_ip_address": {"key": "targetStaticIPAddress", "type": "str"}, + "is_selected_for_migration": {"key": "isSelectedForMigration", "type": "str"}, + "target_nic_name": {"key": "targetNicName", "type": "str"}, + "test_subnet_name": {"key": "testSubnetName", "type": "str"}, + "test_static_ip_address": {"key": "testStaticIPAddress", "type": "str"}, } def __init__( @@ -22231,15 +27746,38 @@ def __init__( target_static_ip_address: Optional[str] = None, is_selected_for_migration: Optional[str] = None, target_nic_name: Optional[str] = None, + test_subnet_name: Optional[str] = None, + test_static_ip_address: Optional[str] = None, **kwargs ): - super(VMwareCbtNicInput, self).__init__(**kwargs) + """ + :keyword nic_id: The NIC Id. Required. + :paramtype nic_id: str + :keyword is_primary_nic: A value indicating whether this is the primary NIC. Required. + :paramtype is_primary_nic: str + :keyword target_subnet_name: Target subnet name. + :paramtype target_subnet_name: str + :keyword target_static_ip_address: The static IP address. + :paramtype target_static_ip_address: str + :keyword is_selected_for_migration: A value indicating whether this NIC is selected for + migration. + :paramtype is_selected_for_migration: str + :keyword target_nic_name: Target NIC name. + :paramtype target_nic_name: str + :keyword test_subnet_name: The test subnet name. + :paramtype test_subnet_name: str + :keyword test_static_ip_address: The test static IP address. + :paramtype test_static_ip_address: str + """ + super().__init__(**kwargs) self.nic_id = nic_id self.is_primary_nic = is_primary_nic self.target_subnet_name = target_subnet_name self.target_static_ip_address = target_static_ip_address self.is_selected_for_migration = is_selected_for_migration self.target_nic_name = target_nic_name + self.test_subnet_name = test_subnet_name + self.test_static_ip_address = test_static_ip_address class VMwareCbtPolicyCreationInput(PolicyProviderSpecificInput): @@ -22247,27 +27785,27 @@ class VMwareCbtPolicyCreationInput(PolicyProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_history_in_minutes: The duration in minutes until which the recovery + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + :vartype recovery_point_history_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in minutes). - :type crash_consistent_frequency_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :type app_consistent_frequency_in_minutes: int + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_in_minutes': {'key': 'recoveryPointHistoryInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, } def __init__( @@ -22278,8 +27816,19 @@ def __init__( app_consistent_frequency_in_minutes: Optional[int] = None, **kwargs ): - super(VMwareCbtPolicyCreationInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + """ + :keyword recovery_point_history_in_minutes: The duration in minutes until which the recovery + points need to be stored. + :paramtype recovery_point_history_in_minutes: int + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :paramtype crash_consistent_frequency_in_minutes: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in + minutes). + :paramtype app_consistent_frequency_in_minutes: int + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.recovery_point_history_in_minutes = recovery_point_history_in_minutes self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes @@ -22290,28 +27839,27 @@ class VmwareCbtPolicyDetails(PolicyProviderSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param recovery_point_history_in_minutes: The duration in minutes until which the recovery + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery points need to be stored. - :type recovery_point_history_in_minutes: int - :param app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :type app_consistent_frequency_in_minutes: int - :param crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + :vartype recovery_point_history_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in minutes. - :type crash_consistent_frequency_in_minutes: int + :vartype crash_consistent_frequency_in_minutes: int """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_history_in_minutes': {'key': 'recoveryPointHistoryInMinutes', 'type': 'int'}, - 'app_consistent_frequency_in_minutes': {'key': 'appConsistentFrequencyInMinutes', 'type': 'int'}, - 'crash_consistent_frequency_in_minutes': {'key': 'crashConsistentFrequencyInMinutes', 'type': 'int'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, + "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, + "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, } def __init__( @@ -22322,14 +27870,24 @@ def __init__( crash_consistent_frequency_in_minutes: Optional[int] = None, **kwargs ): - super(VmwareCbtPolicyDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + """ + :keyword recovery_point_history_in_minutes: The duration in minutes until which the recovery + points need to be stored. + :paramtype recovery_point_history_in_minutes: int + :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :paramtype app_consistent_frequency_in_minutes: int + :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :paramtype crash_consistent_frequency_in_minutes: int + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.recovery_point_history_in_minutes = recovery_point_history_in_minutes self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes -class VMwareCbtProtectedDiskDetails(msrest.serialization.Model): +class VMwareCbtProtectedDiskDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes """VMwareCbt protected disk details. Variables are only populated by the server, and will be ignored when sending a request. @@ -22338,15 +27896,15 @@ class VMwareCbtProtectedDiskDetails(msrest.serialization.Model): :vartype disk_id: str :ivar disk_name: The disk name. :vartype disk_name: str - :param disk_type: The disk type. Possible values include: "Standard_LRS", "Premium_LRS", + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". - :type disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType :ivar disk_path: The disk path. :vartype disk_path: str :ivar is_os_disk: A value indicating whether the disk is the OS disk. :vartype is_os_disk: str :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: long + :vartype capacity_in_bytes: int :ivar log_storage_account_id: The log storage account ARM Id. :vartype log_storage_account_id: str :ivar log_storage_account_sas_secret_name: The key vault secret name of the log storage @@ -22356,48 +27914,63 @@ class VMwareCbtProtectedDiskDetails(msrest.serialization.Model): :vartype disk_encryption_set_id: str :ivar seed_managed_disk_id: The ARM Id of the seed managed disk. :vartype seed_managed_disk_id: str + :ivar seed_blob_uri: The uri of the seed blob. + :vartype seed_blob_uri: str :ivar target_managed_disk_id: The ARM Id of the target managed disk. :vartype target_managed_disk_id: str - :param target_disk_name: The name for the target managed disk. - :type target_disk_name: str + :ivar target_blob_uri: The uri of the target blob. + :vartype target_blob_uri: str + :ivar target_disk_name: The name for the target managed disk. + :vartype target_disk_name: str """ _validation = { - 'disk_id': {'readonly': True}, - 'disk_name': {'readonly': True}, - 'disk_path': {'readonly': True}, - 'is_os_disk': {'readonly': True}, - 'capacity_in_bytes': {'readonly': True}, - 'log_storage_account_id': {'readonly': True}, - 'log_storage_account_sas_secret_name': {'readonly': True}, - 'disk_encryption_set_id': {'readonly': True}, - 'seed_managed_disk_id': {'readonly': True}, - 'target_managed_disk_id': {'readonly': True}, + "disk_id": {"readonly": True}, + "disk_name": {"readonly": True}, + "disk_path": {"readonly": True}, + "is_os_disk": {"readonly": True}, + "capacity_in_bytes": {"readonly": True}, + "log_storage_account_id": {"readonly": True}, + "log_storage_account_sas_secret_name": {"readonly": True}, + "disk_encryption_set_id": {"readonly": True}, + "seed_managed_disk_id": {"readonly": True}, + "seed_blob_uri": {"readonly": True}, + "target_managed_disk_id": {"readonly": True}, + "target_blob_uri": {"readonly": True}, } _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'disk_name': {'key': 'diskName', 'type': 'str'}, - 'disk_type': {'key': 'diskType', 'type': 'str'}, - 'disk_path': {'key': 'diskPath', 'type': 'str'}, - 'is_os_disk': {'key': 'isOSDisk', 'type': 'str'}, - 'capacity_in_bytes': {'key': 'capacityInBytes', 'type': 'long'}, - 'log_storage_account_id': {'key': 'logStorageAccountId', 'type': 'str'}, - 'log_storage_account_sas_secret_name': {'key': 'logStorageAccountSasSecretName', 'type': 'str'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'seed_managed_disk_id': {'key': 'seedManagedDiskId', 'type': 'str'}, - 'target_managed_disk_id': {'key': 'targetManagedDiskId', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "disk_name": {"key": "diskName", "type": "str"}, + "disk_type": {"key": "diskType", "type": "str"}, + "disk_path": {"key": "diskPath", "type": "str"}, + "is_os_disk": {"key": "isOSDisk", "type": "str"}, + "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, + "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, + "log_storage_account_sas_secret_name": {"key": "logStorageAccountSasSecretName", "type": "str"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, + "seed_managed_disk_id": {"key": "seedManagedDiskId", "type": "str"}, + "seed_blob_uri": {"key": "seedBlobUri", "type": "str"}, + "target_managed_disk_id": {"key": "targetManagedDiskId", "type": "str"}, + "target_blob_uri": {"key": "targetBlobUri", "type": "str"}, + "target_disk_name": {"key": "targetDiskName", "type": "str"}, } def __init__( self, *, - disk_type: Optional[Union[str, "DiskAccountType"]] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, target_disk_name: Optional[str] = None, **kwargs ): - super(VMwareCbtProtectedDiskDetails, self).__init__(**kwargs) + """ + :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", and + "StandardSSD_LRS". + :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :keyword target_disk_name: The name for the target managed disk. + :paramtype target_disk_name: str + """ + super().__init__(**kwargs) self.disk_id = None self.disk_name = None self.disk_type = disk_type @@ -22408,7 +27981,9 @@ def __init__( self.log_storage_account_sas_secret_name = None self.disk_encryption_set_id = None self.seed_managed_disk_id = None + self.seed_blob_uri = None self.target_managed_disk_id = None + self.target_blob_uri = None self.target_disk_name = target_disk_name @@ -22419,9 +27994,8 @@ class VMwareCbtProtectionContainerMappingDetails(ProtectionContainerMappingProvi All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str :ivar key_vault_id: The target key vault ARM Id. :vartype key_vault_id: str :ivar key_vault_uri: The target key vault URI. @@ -22435,40 +28009,74 @@ class VMwareCbtProtectionContainerMappingDetails(ProtectionContainerMappingProvi :vartype service_bus_connection_string_secret_name: str :ivar target_location: The target location. :vartype target_location: str + :ivar role_size_to_nic_count_map: The role size to NIC count map. + :vartype role_size_to_nic_count_map: dict[str, int] """ _validation = { - 'instance_type': {'required': True}, - 'key_vault_id': {'readonly': True}, - 'key_vault_uri': {'readonly': True}, - 'storage_account_id': {'readonly': True}, - 'storage_account_sas_secret_name': {'readonly': True}, - 'service_bus_connection_string_secret_name': {'readonly': True}, - 'target_location': {'readonly': True}, + "instance_type": {"required": True}, + "key_vault_id": {"readonly": True}, + "key_vault_uri": {"readonly": True}, + "storage_account_id": {"readonly": True}, + "storage_account_sas_secret_name": {"readonly": True}, + "service_bus_connection_string_secret_name": {"readonly": True}, + "target_location": {"readonly": True}, + "role_size_to_nic_count_map": {"readonly": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'storage_account_sas_secret_name': {'key': 'storageAccountSasSecretName', 'type': 'str'}, - 'service_bus_connection_string_secret_name': {'key': 'serviceBusConnectionStringSecretName', 'type': 'str'}, - 'target_location': {'key': 'targetLocation', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "key_vault_id": {"key": "keyVaultId", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "storage_account_sas_secret_name": {"key": "storageAccountSasSecretName", "type": "str"}, + "service_bus_connection_string_secret_name": {"key": "serviceBusConnectionStringSecretName", "type": "str"}, + "target_location": {"key": "targetLocation", "type": "str"}, + "role_size_to_nic_count_map": {"key": "roleSizeToNicCountMap", "type": "{int}"}, } - def __init__( - self, - **kwargs - ): - super(VMwareCbtProtectionContainerMappingDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.key_vault_id = None self.key_vault_uri = None self.storage_account_id = None self.storage_account_sas_secret_name = None self.service_bus_connection_string_secret_name = None self.target_location = None + self.role_size_to_nic_count_map = None + + +class VMwareCbtResumeReplicationInput(ResumeReplicationProviderSpecificInput): + """VMwareCbt specific resume replication input. + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar delete_migration_resources: A value indicating whether Migration resources to be deleted. + :vartype delete_migration_resources: str + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "delete_migration_resources": {"key": "deleteMigrationResources", "type": "str"}, + } + + def __init__(self, *, delete_migration_resources: Optional[str] = None, **kwargs): + """ + :keyword delete_migration_resources: A value indicating whether Migration resources to be + deleted. + :paramtype delete_migration_resources: str + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str + self.delete_migration_resources = delete_migration_resources class VMwareCbtResyncInput(ResyncProviderSpecificInput): @@ -22476,30 +28084,29 @@ class VMwareCbtResyncInput(ResyncProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param skip_cbt_reset: Required. A value indicating whether CBT is to be reset. - :type skip_cbt_reset: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar skip_cbt_reset: A value indicating whether CBT is to be reset. Required. + :vartype skip_cbt_reset: str """ _validation = { - 'instance_type': {'required': True}, - 'skip_cbt_reset': {'required': True}, + "instance_type": {"required": True}, + "skip_cbt_reset": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'skip_cbt_reset': {'key': 'skipCbtReset', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "skip_cbt_reset": {"key": "skipCbtReset", "type": "str"}, } - def __init__( - self, - *, - skip_cbt_reset: str, - **kwargs - ): - super(VMwareCbtResyncInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + def __init__(self, *, skip_cbt_reset: str, **kwargs): + """ + :keyword skip_cbt_reset: A value indicating whether CBT is to be reset. Required. + :paramtype skip_cbt_reset: str + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.skip_cbt_reset = skip_cbt_reset @@ -22508,24 +28115,27 @@ class VMwareCbtTestMigrateInput(TestMigrateProviderSpecificInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param recovery_point_id: Required. The recovery point Id. - :type recovery_point_id: str - :param network_id: Required. The test network Id. - :type network_id: str + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar recovery_point_id: The recovery point Id. Required. + :vartype recovery_point_id: str + :ivar network_id: The test network Id. Required. + :vartype network_id: str + :ivar vm_nics: The list of NIC details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] """ _validation = { - 'instance_type': {'required': True}, - 'recovery_point_id': {'required': True}, - 'network_id': {'required': True}, + "instance_type": {"required": True}, + "recovery_point_id": {"required": True}, + "network_id": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'network_id': {'key': 'networkId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "network_id": {"key": "networkId", "type": "str"}, + "vm_nics": {"key": "vmNics", "type": "[VMwareCbtNicInput]"}, } def __init__( @@ -22533,113 +28143,137 @@ def __init__( *, recovery_point_id: str, network_id: str, - **kwargs - ): - super(VMwareCbtTestMigrateInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + vm_nics: Optional[List["_models.VMwareCbtNicInput"]] = None, + **kwargs + ): + """ + :keyword recovery_point_id: The recovery point Id. Required. + :paramtype recovery_point_id: str + :keyword network_id: The test network Id. Required. + :paramtype network_id: str + :keyword vm_nics: The list of NIC details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.recovery_point_id = recovery_point_id self.network_id = network_id + self.vm_nics = vm_nics -class VMwareCbtUpdateDiskInput(msrest.serialization.Model): +class VMwareCbtUpdateDiskInput(_serialization.Model): """VMwareCbt disk input for update. All required parameters must be populated in order to send to Azure. - :param disk_id: Required. The disk Id. - :type disk_id: str - :param target_disk_name: The target disk name. - :type target_disk_name: str + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar target_disk_name: The target disk name. + :vartype target_disk_name: str + :ivar is_os_disk: A value indicating whether the disk is the OS disk. + :vartype is_os_disk: str """ _validation = { - 'disk_id': {'required': True}, + "disk_id": {"required": True}, } _attribute_map = { - 'disk_id': {'key': 'diskId', 'type': 'str'}, - 'target_disk_name': {'key': 'targetDiskName', 'type': 'str'}, + "disk_id": {"key": "diskId", "type": "str"}, + "target_disk_name": {"key": "targetDiskName", "type": "str"}, + "is_os_disk": {"key": "isOSDisk", "type": "str"}, } def __init__( - self, - *, - disk_id: str, - target_disk_name: Optional[str] = None, - **kwargs + self, *, disk_id: str, target_disk_name: Optional[str] = None, is_os_disk: Optional[str] = None, **kwargs ): - super(VMwareCbtUpdateDiskInput, self).__init__(**kwargs) + """ + :keyword disk_id: The disk Id. Required. + :paramtype disk_id: str + :keyword target_disk_name: The target disk name. + :paramtype target_disk_name: str + :keyword is_os_disk: A value indicating whether the disk is the OS disk. + :paramtype is_os_disk: str + """ + super().__init__(**kwargs) self.disk_id = disk_id self.target_disk_name = target_disk_name + self.is_os_disk = is_os_disk -class VMwareCbtUpdateMigrationItemInput(UpdateMigrationItemProviderSpecificInput): +class VMwareCbtUpdateMigrationItemInput( + UpdateMigrationItemProviderSpecificInput +): # pylint: disable=too-many-instance-attributes """VMwareCbt specific update migration item input. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. The class type.Constant filled by server. - :type instance_type: str - :param target_vm_name: The target VM name. - :type target_vm_name: str - :param target_vm_size: The target VM size. - :type target_vm_size: str - :param target_resource_group_id: The target resource group ARM Id. - :type target_resource_group_id: str - :param target_availability_set_id: The target availability set ARM Id. - :type target_availability_set_id: str - :param target_availability_zone: The target availability zone. - :type target_availability_zone: str - :param target_proximity_placement_group_id: The target proximity placement group ARM Id. - :type target_proximity_placement_group_id: str - :param target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + :ivar instance_type: The class type. Required. + :vartype instance_type: str + :ivar target_vm_name: The target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_resource_group_id: The target resource group ARM Id. + :vartype target_resource_group_id: str + :ivar target_availability_set_id: The target availability set ARM Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group ARM Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account ARM Id. - :type target_boot_diagnostics_storage_account_id: str - :param target_network_id: The target network ARM Id. - :type target_network_id: str - :param vm_nics: The list of NIC details. - :type vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] - :param vm_disks: The list of disk update properties. - :type vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput] - :param license_type: The license type. Possible values include: "NotSpecified", - "NoLicenseType", "WindowsServer". - :type license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :param sql_server_license_type: The SQL Server license type. Possible values include: - "NotSpecified", "NoLicenseType", "PAYG", "AHUB". - :type sql_server_license_type: str or + :vartype target_boot_diagnostics_storage_account_id: str + :ivar target_network_id: The target network ARM Id. + :vartype target_network_id: str + :ivar test_network_id: The test network ARM Id. + :vartype test_network_id: str + :ivar vm_nics: The list of NIC details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] + :ivar vm_disks: The list of disk update properties. + :vartype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput] + :ivar license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :param perform_auto_resync: A value indicating whether auto resync is to be done. - :type perform_auto_resync: str - :param target_vm_tags: The target VM tags. - :type target_vm_tags: dict[str, str] - :param target_disk_tags: The tags for the target disks. - :type target_disk_tags: dict[str, str] - :param target_nic_tags: The tags for the target NICs. - :type target_nic_tags: dict[str, str] + :ivar perform_auto_resync: A value indicating whether auto resync is to be done. + :vartype perform_auto_resync: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar target_disk_tags: The tags for the target disks. + :vartype target_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'target_vm_name': {'key': 'targetVmName', 'type': 'str'}, - 'target_vm_size': {'key': 'targetVmSize', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'target_availability_set_id': {'key': 'targetAvailabilitySetId', 'type': 'str'}, - 'target_availability_zone': {'key': 'targetAvailabilityZone', 'type': 'str'}, - 'target_proximity_placement_group_id': {'key': 'targetProximityPlacementGroupId', 'type': 'str'}, - 'target_boot_diagnostics_storage_account_id': {'key': 'targetBootDiagnosticsStorageAccountId', 'type': 'str'}, - 'target_network_id': {'key': 'targetNetworkId', 'type': 'str'}, - 'vm_nics': {'key': 'vmNics', 'type': '[VMwareCbtNicInput]'}, - 'vm_disks': {'key': 'vmDisks', 'type': '[VMwareCbtUpdateDiskInput]'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'sql_server_license_type': {'key': 'sqlServerLicenseType', 'type': 'str'}, - 'perform_auto_resync': {'key': 'performAutoResync', 'type': 'str'}, - 'target_vm_tags': {'key': 'targetVmTags', 'type': '{str}'}, - 'target_disk_tags': {'key': 'targetDiskTags', 'type': '{str}'}, - 'target_nic_tags': {'key': 'targetNicTags', 'type': '{str}'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "target_vm_name": {"key": "targetVmName", "type": "str"}, + "target_vm_size": {"key": "targetVmSize", "type": "str"}, + "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, + "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, + "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, + "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, + "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, + "target_network_id": {"key": "targetNetworkId", "type": "str"}, + "test_network_id": {"key": "testNetworkId", "type": "str"}, + "vm_nics": {"key": "vmNics", "type": "[VMwareCbtNicInput]"}, + "vm_disks": {"key": "vmDisks", "type": "[VMwareCbtUpdateDiskInput]"}, + "license_type": {"key": "licenseType", "type": "str"}, + "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, + "perform_auto_resync": {"key": "performAutoResync", "type": "str"}, + "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, + "target_disk_tags": {"key": "targetDiskTags", "type": "{str}"}, + "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, } def __init__( @@ -22653,18 +28287,60 @@ def __init__( target_proximity_placement_group_id: Optional[str] = None, target_boot_diagnostics_storage_account_id: Optional[str] = None, target_network_id: Optional[str] = None, - vm_nics: Optional[List["VMwareCbtNicInput"]] = None, - vm_disks: Optional[List["VMwareCbtUpdateDiskInput"]] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, - sql_server_license_type: Optional[Union[str, "SqlServerLicenseType"]] = None, + test_network_id: Optional[str] = None, + vm_nics: Optional[List["_models.VMwareCbtNicInput"]] = None, + vm_disks: Optional[List["_models.VMwareCbtUpdateDiskInput"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, perform_auto_resync: Optional[str] = None, target_vm_tags: Optional[Dict[str, str]] = None, target_disk_tags: Optional[Dict[str, str]] = None, target_nic_tags: Optional[Dict[str, str]] = None, **kwargs ): - super(VMwareCbtUpdateMigrationItemInput, self).__init__(**kwargs) - self.instance_type = 'VMwareCbt' # type: str + """ + :keyword target_vm_name: The target VM name. + :paramtype target_vm_name: str + :keyword target_vm_size: The target VM size. + :paramtype target_vm_size: str + :keyword target_resource_group_id: The target resource group ARM Id. + :paramtype target_resource_group_id: str + :keyword target_availability_set_id: The target availability set ARM Id. + :paramtype target_availability_set_id: str + :keyword target_availability_zone: The target availability zone. + :paramtype target_availability_zone: str + :keyword target_proximity_placement_group_id: The target proximity placement group ARM Id. + :paramtype target_proximity_placement_group_id: str + :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage + account ARM Id. + :paramtype target_boot_diagnostics_storage_account_id: str + :keyword target_network_id: The target network ARM Id. + :paramtype target_network_id: str + :keyword test_network_id: The test network ARM Id. + :paramtype test_network_id: str + :keyword vm_nics: The list of NIC details. + :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] + :keyword vm_disks: The list of disk update properties. + :paramtype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput] + :keyword license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :keyword sql_server_license_type: The SQL Server license type. Known values are: + "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". + :paramtype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :keyword perform_auto_resync: A value indicating whether auto resync is to be done. + :paramtype perform_auto_resync: str + :keyword target_vm_tags: The target VM tags. + :paramtype target_vm_tags: dict[str, str] + :keyword target_disk_tags: The tags for the target disks. + :paramtype target_disk_tags: dict[str, str] + :keyword target_nic_tags: The tags for the target NICs. + :paramtype target_nic_tags: dict[str, str] + """ + super().__init__(**kwargs) + self.instance_type = "VMwareCbt" # type: str self.target_vm_name = target_vm_name self.target_vm_size = target_vm_size self.target_resource_group_id = target_resource_group_id @@ -22673,6 +28349,7 @@ def __init__( self.target_proximity_placement_group_id = target_proximity_placement_group_id self.target_boot_diagnostics_storage_account_id = target_boot_diagnostics_storage_account_id self.target_network_id = target_network_id + self.test_network_id = test_network_id self.vm_nics = vm_nics self.vm_disks = vm_disks self.license_type = license_type @@ -22683,127 +28360,133 @@ def __init__( self.target_nic_tags = target_nic_tags -class VMwareDetails(FabricSpecificDetails): +class VMwareDetails(FabricSpecificDetails): # pylint: disable=too-many-instance-attributes """Store the fabric details specific to the VMware fabric. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param process_servers: The list of Process Servers associated with the fabric. - :type process_servers: list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServer] - :param master_target_servers: The list of Master Target servers associated with the fabric. - :type master_target_servers: + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar process_servers: The list of Process Servers associated with the fabric. + :vartype process_servers: list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServer] + :ivar master_target_servers: The list of Master Target servers associated with the fabric. + :vartype master_target_servers: list[~azure.mgmt.recoveryservicessiterecovery.models.MasterTargetServer] - :param run_as_accounts: The list of run as accounts created on the server. - :type run_as_accounts: list[~azure.mgmt.recoveryservicessiterecovery.models.RunAsAccount] - :param replication_pair_count: The number of replication pairs configured in this CS. - :type replication_pair_count: str - :param process_server_count: The number of process servers. - :type process_server_count: str - :param agent_count: The number of source and target servers configured to talk to this CS. - :type agent_count: str - :param protected_servers: The number of protected servers. - :type protected_servers: str - :param system_load: The percentage of the system load. - :type system_load: str - :param system_load_status: The system load status. - :type system_load_status: str - :param cpu_load: The percentage of the CPU load. - :type cpu_load: str - :param cpu_load_status: The CPU load status. - :type cpu_load_status: str - :param total_memory_in_bytes: The total memory. - :type total_memory_in_bytes: long - :param available_memory_in_bytes: The available memory. - :type available_memory_in_bytes: long - :param memory_usage_status: The memory usage status. - :type memory_usage_status: str - :param total_space_in_bytes: The total space. - :type total_space_in_bytes: long - :param available_space_in_bytes: The available space. - :type available_space_in_bytes: long - :param space_usage_status: The space usage status. - :type space_usage_status: str - :param web_load: The web load. - :type web_load: str - :param web_load_status: The web load status. - :type web_load_status: str - :param database_server_load: The database server load. - :type database_server_load: str - :param database_server_load_status: The database server load status. - :type database_server_load_status: str - :param cs_service_status: The CS service status. - :type cs_service_status: str - :param ip_address: The IP address. - :type ip_address: str - :param agent_version: The agent Version. - :type agent_version: str - :param host_name: The host name. - :type host_name: str - :param last_heartbeat: The last heartbeat received from CS server. - :type last_heartbeat: ~datetime.datetime - :param version_status: Version status. - :type version_status: str - :param ssl_cert_expiry_date: CS SSL cert expiry date. - :type ssl_cert_expiry_date: ~datetime.datetime - :param ssl_cert_expiry_remaining_days: CS SSL cert expiry date. - :type ssl_cert_expiry_remaining_days: int - :param ps_template_version: PS template version. - :type ps_template_version: str - :param agent_expiry_date: Agent expiry date. - :type agent_expiry_date: ~datetime.datetime - :param agent_version_details: The agent version details. - :type agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - - _validation = { - 'instance_type': {'required': True}, - } - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'process_servers': {'key': 'processServers', 'type': '[ProcessServer]'}, - 'master_target_servers': {'key': 'masterTargetServers', 'type': '[MasterTargetServer]'}, - 'run_as_accounts': {'key': 'runAsAccounts', 'type': '[RunAsAccount]'}, - 'replication_pair_count': {'key': 'replicationPairCount', 'type': 'str'}, - 'process_server_count': {'key': 'processServerCount', 'type': 'str'}, - 'agent_count': {'key': 'agentCount', 'type': 'str'}, - 'protected_servers': {'key': 'protectedServers', 'type': 'str'}, - 'system_load': {'key': 'systemLoad', 'type': 'str'}, - 'system_load_status': {'key': 'systemLoadStatus', 'type': 'str'}, - 'cpu_load': {'key': 'cpuLoad', 'type': 'str'}, - 'cpu_load_status': {'key': 'cpuLoadStatus', 'type': 'str'}, - 'total_memory_in_bytes': {'key': 'totalMemoryInBytes', 'type': 'long'}, - 'available_memory_in_bytes': {'key': 'availableMemoryInBytes', 'type': 'long'}, - 'memory_usage_status': {'key': 'memoryUsageStatus', 'type': 'str'}, - 'total_space_in_bytes': {'key': 'totalSpaceInBytes', 'type': 'long'}, - 'available_space_in_bytes': {'key': 'availableSpaceInBytes', 'type': 'long'}, - 'space_usage_status': {'key': 'spaceUsageStatus', 'type': 'str'}, - 'web_load': {'key': 'webLoad', 'type': 'str'}, - 'web_load_status': {'key': 'webLoadStatus', 'type': 'str'}, - 'database_server_load': {'key': 'databaseServerLoad', 'type': 'str'}, - 'database_server_load_status': {'key': 'databaseServerLoadStatus', 'type': 'str'}, - 'cs_service_status': {'key': 'csServiceStatus', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'last_heartbeat': {'key': 'lastHeartbeat', 'type': 'iso-8601'}, - 'version_status': {'key': 'versionStatus', 'type': 'str'}, - 'ssl_cert_expiry_date': {'key': 'sslCertExpiryDate', 'type': 'iso-8601'}, - 'ssl_cert_expiry_remaining_days': {'key': 'sslCertExpiryRemainingDays', 'type': 'int'}, - 'ps_template_version': {'key': 'psTemplateVersion', 'type': 'str'}, - 'agent_expiry_date': {'key': 'agentExpiryDate', 'type': 'iso-8601'}, - 'agent_version_details': {'key': 'agentVersionDetails', 'type': 'VersionDetails'}, - } - - def __init__( - self, - *, - process_servers: Optional[List["ProcessServer"]] = None, - master_target_servers: Optional[List["MasterTargetServer"]] = None, - run_as_accounts: Optional[List["RunAsAccount"]] = None, + :ivar run_as_accounts: The list of run as accounts created on the server. + :vartype run_as_accounts: list[~azure.mgmt.recoveryservicessiterecovery.models.RunAsAccount] + :ivar replication_pair_count: The number of replication pairs configured in this CS. + :vartype replication_pair_count: str + :ivar process_server_count: The number of process servers. + :vartype process_server_count: str + :ivar agent_count: The number of source and target servers configured to talk to this CS. + :vartype agent_count: str + :ivar protected_servers: The number of protected servers. + :vartype protected_servers: str + :ivar system_load: The percentage of the system load. + :vartype system_load: str + :ivar system_load_status: The system load status. + :vartype system_load_status: str + :ivar cpu_load: The percentage of the CPU load. + :vartype cpu_load: str + :ivar cpu_load_status: The CPU load status. + :vartype cpu_load_status: str + :ivar total_memory_in_bytes: The total memory. + :vartype total_memory_in_bytes: int + :ivar available_memory_in_bytes: The available memory. + :vartype available_memory_in_bytes: int + :ivar memory_usage_status: The memory usage status. + :vartype memory_usage_status: str + :ivar total_space_in_bytes: The total space. + :vartype total_space_in_bytes: int + :ivar available_space_in_bytes: The available space. + :vartype available_space_in_bytes: int + :ivar space_usage_status: The space usage status. + :vartype space_usage_status: str + :ivar web_load: The web load. + :vartype web_load: str + :ivar web_load_status: The web load status. + :vartype web_load_status: str + :ivar database_server_load: The database server load. + :vartype database_server_load: str + :ivar database_server_load_status: The database server load status. + :vartype database_server_load_status: str + :ivar cs_service_status: The CS service status. + :vartype cs_service_status: str + :ivar ip_address: The IP address. + :vartype ip_address: str + :ivar agent_version: The agent Version. + :vartype agent_version: str + :ivar host_name: The host name. + :vartype host_name: str + :ivar last_heartbeat: The last heartbeat received from CS server. + :vartype last_heartbeat: ~datetime.datetime + :ivar version_status: Version status. + :vartype version_status: str + :ivar ssl_cert_expiry_date: CS SSL cert expiry date. + :vartype ssl_cert_expiry_date: ~datetime.datetime + :ivar ssl_cert_expiry_remaining_days: CS SSL cert expiry date. + :vartype ssl_cert_expiry_remaining_days: int + :ivar ps_template_version: PS template version. + :vartype ps_template_version: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar agent_version_details: The agent version details. + :vartype agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + :ivar switch_provider_blocking_error_details: The switch provider blocking error information. + :vartype switch_provider_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageFabricSwitchProviderBlockingErrorDetails] + """ + + _validation = { + "instance_type": {"required": True}, + } + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "process_servers": {"key": "processServers", "type": "[ProcessServer]"}, + "master_target_servers": {"key": "masterTargetServers", "type": "[MasterTargetServer]"}, + "run_as_accounts": {"key": "runAsAccounts", "type": "[RunAsAccount]"}, + "replication_pair_count": {"key": "replicationPairCount", "type": "str"}, + "process_server_count": {"key": "processServerCount", "type": "str"}, + "agent_count": {"key": "agentCount", "type": "str"}, + "protected_servers": {"key": "protectedServers", "type": "str"}, + "system_load": {"key": "systemLoad", "type": "str"}, + "system_load_status": {"key": "systemLoadStatus", "type": "str"}, + "cpu_load": {"key": "cpuLoad", "type": "str"}, + "cpu_load_status": {"key": "cpuLoadStatus", "type": "str"}, + "total_memory_in_bytes": {"key": "totalMemoryInBytes", "type": "int"}, + "available_memory_in_bytes": {"key": "availableMemoryInBytes", "type": "int"}, + "memory_usage_status": {"key": "memoryUsageStatus", "type": "str"}, + "total_space_in_bytes": {"key": "totalSpaceInBytes", "type": "int"}, + "available_space_in_bytes": {"key": "availableSpaceInBytes", "type": "int"}, + "space_usage_status": {"key": "spaceUsageStatus", "type": "str"}, + "web_load": {"key": "webLoad", "type": "str"}, + "web_load_status": {"key": "webLoadStatus", "type": "str"}, + "database_server_load": {"key": "databaseServerLoad", "type": "str"}, + "database_server_load_status": {"key": "databaseServerLoadStatus", "type": "str"}, + "cs_service_status": {"key": "csServiceStatus", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "agent_version": {"key": "agentVersion", "type": "str"}, + "host_name": {"key": "hostName", "type": "str"}, + "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, + "version_status": {"key": "versionStatus", "type": "str"}, + "ssl_cert_expiry_date": {"key": "sslCertExpiryDate", "type": "iso-8601"}, + "ssl_cert_expiry_remaining_days": {"key": "sslCertExpiryRemainingDays", "type": "int"}, + "ps_template_version": {"key": "psTemplateVersion", "type": "str"}, + "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, + "agent_version_details": {"key": "agentVersionDetails", "type": "VersionDetails"}, + "switch_provider_blocking_error_details": { + "key": "switchProviderBlockingErrorDetails", + "type": "[InMageFabricSwitchProviderBlockingErrorDetails]", + }, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + process_servers: Optional[List["_models.ProcessServer"]] = None, + master_target_servers: Optional[List["_models.MasterTargetServer"]] = None, + run_as_accounts: Optional[List["_models.RunAsAccount"]] = None, replication_pair_count: Optional[str] = None, process_server_count: Optional[str] = None, agent_count: Optional[str] = None, @@ -22832,11 +28515,86 @@ def __init__( ssl_cert_expiry_remaining_days: Optional[int] = None, ps_template_version: Optional[str] = None, agent_expiry_date: Optional[datetime.datetime] = None, - agent_version_details: Optional["VersionDetails"] = None, - **kwargs - ): - super(VMwareDetails, self).__init__(**kwargs) - self.instance_type = 'VMware' # type: str + agent_version_details: Optional["_models.VersionDetails"] = None, + switch_provider_blocking_error_details: Optional[ + List["_models.InMageFabricSwitchProviderBlockingErrorDetails"] + ] = None, + **kwargs + ): + """ + :keyword process_servers: The list of Process Servers associated with the fabric. + :paramtype process_servers: list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServer] + :keyword master_target_servers: The list of Master Target servers associated with the fabric. + :paramtype master_target_servers: + list[~azure.mgmt.recoveryservicessiterecovery.models.MasterTargetServer] + :keyword run_as_accounts: The list of run as accounts created on the server. + :paramtype run_as_accounts: list[~azure.mgmt.recoveryservicessiterecovery.models.RunAsAccount] + :keyword replication_pair_count: The number of replication pairs configured in this CS. + :paramtype replication_pair_count: str + :keyword process_server_count: The number of process servers. + :paramtype process_server_count: str + :keyword agent_count: The number of source and target servers configured to talk to this CS. + :paramtype agent_count: str + :keyword protected_servers: The number of protected servers. + :paramtype protected_servers: str + :keyword system_load: The percentage of the system load. + :paramtype system_load: str + :keyword system_load_status: The system load status. + :paramtype system_load_status: str + :keyword cpu_load: The percentage of the CPU load. + :paramtype cpu_load: str + :keyword cpu_load_status: The CPU load status. + :paramtype cpu_load_status: str + :keyword total_memory_in_bytes: The total memory. + :paramtype total_memory_in_bytes: int + :keyword available_memory_in_bytes: The available memory. + :paramtype available_memory_in_bytes: int + :keyword memory_usage_status: The memory usage status. + :paramtype memory_usage_status: str + :keyword total_space_in_bytes: The total space. + :paramtype total_space_in_bytes: int + :keyword available_space_in_bytes: The available space. + :paramtype available_space_in_bytes: int + :keyword space_usage_status: The space usage status. + :paramtype space_usage_status: str + :keyword web_load: The web load. + :paramtype web_load: str + :keyword web_load_status: The web load status. + :paramtype web_load_status: str + :keyword database_server_load: The database server load. + :paramtype database_server_load: str + :keyword database_server_load_status: The database server load status. + :paramtype database_server_load_status: str + :keyword cs_service_status: The CS service status. + :paramtype cs_service_status: str + :keyword ip_address: The IP address. + :paramtype ip_address: str + :keyword agent_version: The agent Version. + :paramtype agent_version: str + :keyword host_name: The host name. + :paramtype host_name: str + :keyword last_heartbeat: The last heartbeat received from CS server. + :paramtype last_heartbeat: ~datetime.datetime + :keyword version_status: Version status. + :paramtype version_status: str + :keyword ssl_cert_expiry_date: CS SSL cert expiry date. + :paramtype ssl_cert_expiry_date: ~datetime.datetime + :keyword ssl_cert_expiry_remaining_days: CS SSL cert expiry date. + :paramtype ssl_cert_expiry_remaining_days: int + :keyword ps_template_version: PS template version. + :paramtype ps_template_version: str + :keyword agent_expiry_date: Agent expiry date. + :paramtype agent_expiry_date: ~datetime.datetime + :keyword agent_version_details: The agent version details. + :paramtype agent_version_details: + ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + :keyword switch_provider_blocking_error_details: The switch provider blocking error + information. + :paramtype switch_provider_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageFabricSwitchProviderBlockingErrorDetails] + """ + super().__init__(**kwargs) + self.instance_type = "VMware" # type: str self.process_servers = process_servers self.master_target_servers = master_target_servers self.run_as_accounts = run_as_accounts @@ -22869,6 +28627,7 @@ def __init__( self.ps_template_version = ps_template_version self.agent_expiry_date = agent_expiry_date self.agent_version_details = agent_version_details + self.switch_provider_blocking_error_details = switch_provider_blocking_error_details class VMwareV2FabricCreationInput(FabricSpecificCreationInput): @@ -22876,26 +28635,26 @@ class VMwareV2FabricCreationInput(FabricSpecificCreationInput): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type.Constant filled by server. - :type instance_type: str - :param vmware_site_id: The ARM Id of the VMware site. - :type vmware_site_id: str - :param physical_site_id: The ARM Id of the physical site. - :type physical_site_id: str - :param migration_solution_id: Required. The ARM Id of the migration solution. - :type migration_solution_id: str + :ivar instance_type: Gets the class type. Required. + :vartype instance_type: str + :ivar vmware_site_id: The ARM Id of the VMware site. + :vartype vmware_site_id: str + :ivar physical_site_id: The ARM Id of the physical site. + :vartype physical_site_id: str + :ivar migration_solution_id: The ARM Id of the migration solution. Required. + :vartype migration_solution_id: str """ _validation = { - 'instance_type': {'required': True}, - 'migration_solution_id': {'required': True}, + "instance_type": {"required": True}, + "migration_solution_id": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_site_id': {'key': 'vmwareSiteId', 'type': 'str'}, - 'physical_site_id': {'key': 'physicalSiteId', 'type': 'str'}, - 'migration_solution_id': {'key': 'migrationSolutionId', 'type': 'str'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, + "physical_site_id": {"key": "physicalSiteId", "type": "str"}, + "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, } def __init__( @@ -22906,8 +28665,16 @@ def __init__( physical_site_id: Optional[str] = None, **kwargs ): - super(VMwareV2FabricCreationInput, self).__init__(**kwargs) - self.instance_type = 'VMwareV2' # type: str + """ + :keyword vmware_site_id: The ARM Id of the VMware site. + :paramtype vmware_site_id: str + :keyword physical_site_id: The ARM Id of the physical site. + :paramtype physical_site_id: str + :keyword migration_solution_id: The ARM Id of the migration solution. Required. + :paramtype migration_solution_id: str + """ + super().__init__(**kwargs) + self.instance_type = "VMwareV2" # type: str self.vmware_site_id = vmware_site_id self.physical_site_id = physical_site_id self.migration_solution_id = migration_solution_id @@ -22920,9 +28687,8 @@ class VMwareV2FabricSpecificDetails(FabricSpecificDetails): All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str :ivar vmware_site_id: The ARM Id of the VMware site. :vartype vmware_site_id: str :ivar physical_site_id: The ARM Id of the physical site. @@ -22941,33 +28707,31 @@ class VMwareV2FabricSpecificDetails(FabricSpecificDetails): """ _validation = { - 'instance_type': {'required': True}, - 'vmware_site_id': {'readonly': True}, - 'physical_site_id': {'readonly': True}, - 'migration_solution_id': {'readonly': True}, - 'service_endpoint': {'readonly': True}, - 'service_resource_id': {'readonly': True}, - 'service_container_id': {'readonly': True}, - 'process_servers': {'readonly': True}, + "instance_type": {"required": True}, + "vmware_site_id": {"readonly": True}, + "physical_site_id": {"readonly": True}, + "migration_solution_id": {"readonly": True}, + "service_endpoint": {"readonly": True}, + "service_resource_id": {"readonly": True}, + "service_container_id": {"readonly": True}, + "process_servers": {"readonly": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'vmware_site_id': {'key': 'vmwareSiteId', 'type': 'str'}, - 'physical_site_id': {'key': 'physicalSiteId', 'type': 'str'}, - 'migration_solution_id': {'key': 'migrationSolutionId', 'type': 'str'}, - 'service_endpoint': {'key': 'serviceEndpoint', 'type': 'str'}, - 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, - 'service_container_id': {'key': 'serviceContainerId', 'type': 'str'}, - 'process_servers': {'key': 'processServers', 'type': '[ProcessServerDetails]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, + "physical_site_id": {"key": "physicalSiteId", "type": "str"}, + "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, + "service_endpoint": {"key": "serviceEndpoint", "type": "str"}, + "service_resource_id": {"key": "serviceResourceId", "type": "str"}, + "service_container_id": {"key": "serviceContainerId", "type": "str"}, + "process_servers": {"key": "processServers", "type": "[ProcessServerDetails]"}, } - def __init__( - self, - **kwargs - ): - super(VMwareV2FabricSpecificDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareV2' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.instance_type = "VMwareV2" # type: str self.vmware_site_id = None self.physical_site_id = None self.migration_solution_id = None @@ -22977,54 +28741,53 @@ def __init__( self.process_servers = None -class VMwareVirtualMachineDetails(ConfigurationSettings): +class VMwareVirtualMachineDetails(ConfigurationSettings): # pylint: disable=too-many-instance-attributes """VMware provider specific settings. All required parameters must be populated in order to send to Azure. - :param instance_type: Required. Gets the class type. Overridden in derived classes.Constant - filled by server. - :type instance_type: str - :param agent_generated_id: The ID generated by the InMage agent after it gets installed on + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. + :vartype instance_type: str + :ivar agent_generated_id: The ID generated by the InMage agent after it gets installed on guest. This is the ID to be used during InMage CreateProtection. - :type agent_generated_id: str - :param agent_installed: The value indicating if InMage scout agent is installed on guest. - :type agent_installed: str - :param os_type: The OsType installed on VM. - :type os_type: str - :param agent_version: The agent version. - :type agent_version: str - :param ip_address: The IP address. - :type ip_address: str - :param powered_on: The value indicating whether VM is powered on. - :type powered_on: str - :param v_center_infrastructure_id: The VCenter infrastructure Id. - :type v_center_infrastructure_id: str - :param discovery_type: A value indicating the discovery type of the machine. Value can be + :vartype agent_generated_id: str + :ivar agent_installed: The value indicating if InMage scout agent is installed on guest. + :vartype agent_installed: str + :ivar os_type: The OsType installed on VM. + :vartype os_type: str + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar ip_address: The IP address. + :vartype ip_address: str + :ivar powered_on: The value indicating whether VM is powered on. + :vartype powered_on: str + :ivar v_center_infrastructure_id: The VCenter infrastructure Id. + :vartype v_center_infrastructure_id: str + :ivar discovery_type: A value indicating the discovery type of the machine. Value can be vCenter or physical. - :type discovery_type: str - :param disk_details: The disk details. - :type disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskDetails] - :param validation_errors: The validation errors. - :type validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :vartype discovery_type: str + :ivar disk_details: The disk details. + :vartype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskDetails] + :ivar validation_errors: The validation errors. + :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] """ _validation = { - 'instance_type': {'required': True}, + "instance_type": {"required": True}, } _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'agent_generated_id': {'key': 'agentGeneratedId', 'type': 'str'}, - 'agent_installed': {'key': 'agentInstalled', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'powered_on': {'key': 'poweredOn', 'type': 'str'}, - 'v_center_infrastructure_id': {'key': 'vCenterInfrastructureId', 'type': 'str'}, - 'discovery_type': {'key': 'discoveryType', 'type': 'str'}, - 'disk_details': {'key': 'diskDetails', 'type': '[InMageDiskDetails]'}, - 'validation_errors': {'key': 'validationErrors', 'type': '[HealthError]'}, + "instance_type": {"key": "instanceType", "type": "str"}, + "agent_generated_id": {"key": "agentGeneratedId", "type": "str"}, + "agent_installed": {"key": "agentInstalled", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "agent_version": {"key": "agentVersion", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "powered_on": {"key": "poweredOn", "type": "str"}, + "v_center_infrastructure_id": {"key": "vCenterInfrastructureId", "type": "str"}, + "discovery_type": {"key": "discoveryType", "type": "str"}, + "disk_details": {"key": "diskDetails", "type": "[InMageDiskDetails]"}, + "validation_errors": {"key": "validationErrors", "type": "[HealthError]"}, } def __init__( @@ -23038,12 +28801,37 @@ def __init__( powered_on: Optional[str] = None, v_center_infrastructure_id: Optional[str] = None, discovery_type: Optional[str] = None, - disk_details: Optional[List["InMageDiskDetails"]] = None, - validation_errors: Optional[List["HealthError"]] = None, - **kwargs - ): - super(VMwareVirtualMachineDetails, self).__init__(**kwargs) - self.instance_type = 'VMwareVirtualMachine' # type: str + disk_details: Optional[List["_models.InMageDiskDetails"]] = None, + validation_errors: Optional[List["_models.HealthError"]] = None, + **kwargs + ): + """ + :keyword agent_generated_id: The ID generated by the InMage agent after it gets installed on + guest. This is the ID to be used during InMage CreateProtection. + :paramtype agent_generated_id: str + :keyword agent_installed: The value indicating if InMage scout agent is installed on guest. + :paramtype agent_installed: str + :keyword os_type: The OsType installed on VM. + :paramtype os_type: str + :keyword agent_version: The agent version. + :paramtype agent_version: str + :keyword ip_address: The IP address. + :paramtype ip_address: str + :keyword powered_on: The value indicating whether VM is powered on. + :paramtype powered_on: str + :keyword v_center_infrastructure_id: The VCenter infrastructure Id. + :paramtype v_center_infrastructure_id: str + :keyword discovery_type: A value indicating the discovery type of the machine. Value can be + vCenter or physical. + :paramtype discovery_type: str + :keyword disk_details: The disk details. + :paramtype disk_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskDetails] + :keyword validation_errors: The validation errors. + :paramtype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + super().__init__(**kwargs) + self.instance_type = "VMwareVirtualMachine" # type: str self.agent_generated_id = agent_generated_id self.agent_installed = agent_installed self.os_type = os_type diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_site_recovery_management_client_enums.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_site_recovery_management_client_enums.py index 8986b8a0a7be..a743df64d729 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_site_recovery_management_client_enums.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_site_recovery_management_client_enums.py @@ -6,51 +6,36 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class A2ARecoveryAvailabilityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The recovery availability type of the virtual machine. - """ +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class A2ARecoveryAvailabilityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The recovery availability type of the virtual machine.""" SINGLE = "Single" AVAILABILITY_SET = "AvailabilitySet" AVAILABILITY_ZONE = "AvailabilityZone" -class A2ARpRecoveryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The recovery point type. - """ + +class A2ARpRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The recovery point type.""" LATEST = "Latest" LATEST_APPLICATION_CONSISTENT = "LatestApplicationConsistent" LATEST_CRASH_CONSISTENT = "LatestCrashConsistent" LATEST_PROCESSED = "LatestProcessed" -class AgentAutoUpdateStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """A value indicating whether the auto update is enabled. - """ + +class AgentAutoUpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating whether the auto update is enabled.""" DISABLED = "Disabled" ENABLED = "Enabled" -class AgentUpgradeBlockedReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class AgentUpgradeBlockedReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AgentUpgradeBlockedReason.""" ALREADY_ON_LATEST_VERSION = "AlreadyOnLatestVersion" REBOOT_REQUIRED = "RebootRequired" @@ -67,9 +52,9 @@ class AgentUpgradeBlockedReason(with_metaclass(_CaseInsensitiveEnumMeta, str, En INVALID_DRIVER_VERSION = "InvalidDriverVersion" UNKNOWN = "Unknown" -class AgentVersionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """A value indicating whether security update required. - """ + +class AgentVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating whether security update required.""" SUPPORTED = "Supported" NOT_SUPPORTED = "NotSupported" @@ -77,45 +62,52 @@ class AgentVersionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATE_REQUIRED = "UpdateRequired" SECURITY_UPDATE_REQUIRED = "SecurityUpdateRequired" -class AlternateLocationRecoveryOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The ALR option. - """ + +class AlternateLocationRecoveryOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The ALR option.""" CREATE_VM_IF_NOT_FOUND = "CreateVmIfNotFound" NO_ACTION = "NoAction" -class AutoProtectionOfDataDisk(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """A value indicating whether the auto protection is enabled. - """ + +class AutomationAccountAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating the type authentication to use for automation Account.""" + + RUN_AS_ACCOUNT = "RunAsAccount" + SYSTEM_ASSIGNED_IDENTITY = "SystemAssignedIdentity" + + +class AutoProtectionOfDataDisk(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating whether the auto protection is enabled.""" DISABLED = "Disabled" ENABLED = "Enabled" -class DataSyncStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The data sync option. - """ + +class DataSyncStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The data sync option.""" FOR_DOWN_TIME = "ForDownTime" FOR_SYNCHRONIZATION = "ForSynchronization" -class DisableProtectionReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Disable protection reason. It can have values NotSpecified/MigrationComplete. - """ + +class DisableProtectionReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Disable protection reason. It can have values NotSpecified/MigrationComplete.""" NOT_SPECIFIED = "NotSpecified" MIGRATION_COMPLETE = "MigrationComplete" -class DiskAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The DiskType. - """ + +class DiskAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The DiskType.""" STANDARD_LRS = "Standard_LRS" PREMIUM_LRS = "Premium_LRS" STANDARD_SSD_LRS = "StandardSSD_LRS" -class DiskReplicationProgressHealth(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The progress health. - """ + +class DiskReplicationProgressHealth(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The progress health.""" NONE = "None" IN_PROGRESS = "InProgress" @@ -123,32 +115,38 @@ class DiskReplicationProgressHealth(with_metaclass(_CaseInsensitiveEnumMeta, str NO_PROGRESS = "NoProgress" QUEUED = "Queued" -class EthernetAddressType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The source IP address type. - """ + +class EthernetAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The source IP address type.""" DYNAMIC = "Dynamic" STATIC = "Static" -class ExportJobOutputSerializationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The output type of the jobs. - """ + +class ExportJobOutputSerializationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The output type of the jobs.""" JSON = "Json" XML = "Xml" EXCEL = "Excel" -class FailoverDeploymentModel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The failover deployment model. - """ + +class ExtendedLocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The extended location type.""" + + EDGE_ZONE = "EdgeZone" + + +class FailoverDeploymentModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The failover deployment model.""" NOT_APPLICABLE = "NotApplicable" CLASSIC = "Classic" RESOURCE_MANAGER = "ResourceManager" -class HealthErrorCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The category of the health error. - """ + +class HealthErrorCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The category of the health error.""" NONE = "None" REPLICATION = "Replication" @@ -162,64 +160,68 @@ class HealthErrorCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AGENT_AUTO_UPDATE_RUN_AS_ACCOUNT_EXPIRY = "AgentAutoUpdateRunAsAccountExpiry" AGENT_AUTO_UPDATE_RUN_AS_ACCOUNT_EXPIRED = "AgentAutoUpdateRunAsAccountExpired" -class HealthErrorCustomerResolvability(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Value indicating whether the health error is customer resolvable. - """ + +class HealthErrorCustomerResolvability(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Value indicating whether the health error is customer resolvable.""" ALLOWED = "Allowed" NOT_ALLOWED = "NotAllowed" -class HyperVReplicaAzureRpRecoveryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The recovery point type. - """ + +class HyperVReplicaAzureRpRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The recovery point type.""" LATEST = "Latest" LATEST_APPLICATION_CONSISTENT = "LatestApplicationConsistent" LATEST_PROCESSED = "LatestProcessed" -class InMageRcmFailbackRecoveryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The recovery point type. - """ + +class InMageRcmFailbackRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The recovery point type.""" APPLICATION_CONSISTENT = "ApplicationConsistent" CRASH_CONSISTENT = "CrashConsistent" -class InMageV2RpRecoveryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The recovery point type. - """ + +class InMageV2RpRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The recovery point type.""" LATEST = "Latest" LATEST_APPLICATION_CONSISTENT = "LatestApplicationConsistent" LATEST_CRASH_CONSISTENT = "LatestCrashConsistent" LATEST_PROCESSED = "LatestProcessed" -class LicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """License type. - """ + +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """License type.""" NOT_SPECIFIED = "NotSpecified" NO_LICENSE_TYPE = "NoLicenseType" WINDOWS_SERVER = "WindowsServer" -class MigrationItemOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class MigrationItemOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MigrationItemOperation.""" DISABLE_MIGRATION = "DisableMigration" TEST_MIGRATE = "TestMigrate" TEST_MIGRATE_CLEANUP = "TestMigrateCleanup" MIGRATE = "Migrate" START_RESYNC = "StartResync" + PAUSE_REPLICATION = "PauseReplication" + RESUME_REPLICATION = "ResumeReplication" -class MigrationRecoveryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The recovery point type. - """ + +class MigrationRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The recovery point type.""" NOT_SPECIFIED = "NotSpecified" APPLICATION_CONSISTENT = "ApplicationConsistent" CRASH_CONSISTENT = "CrashConsistent" -class MigrationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The migration status. - """ + +class MigrationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The migration status.""" NONE = "None" ENABLE_MIGRATION_IN_PROGRESS = "EnableMigrationInProgress" @@ -232,24 +234,31 @@ class MigrationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MIGRATION_IN_PROGRESS = "MigrationInProgress" MIGRATION_SUCCEEDED = "MigrationSucceeded" MIGRATION_FAILED = "MigrationFailed" + RESUME_IN_PROGRESS = "ResumeInProgress" + RESUME_INITIATED = "ResumeInitiated" + SUSPENDING_PROTECTION = "SuspendingProtection" + PROTECTION_SUSPENDED = "ProtectionSuspended" + MIGRATION_COMPLETED_WITH_INFORMATION = "MigrationCompletedWithInformation" + MIGRATION_PARTIALLY_SUCCEEDED = "MigrationPartiallySucceeded" -class MobilityAgentUpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The agent auto upgrade state. - """ + +class MobilityAgentUpgradeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The agent auto upgrade state.""" NONE = "None" STARTED = "Started" COMPLETED = "Completed" COMMIT = "Commit" -class MultiVmGroupCreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Whether Multi VM group is auto created or specified by user. - """ + +class MultiVmGroupCreateOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether Multi VM group is auto created or specified by user.""" AUTO_CREATED = "AutoCreated" USER_SPECIFIED = "UserSpecified" -class MultiVmSyncPointOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class MultiVmSyncPointOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. """ @@ -257,21 +266,24 @@ class MultiVmSyncPointOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) USE_MULTI_VM_SYNC_RECOVERY_POINT = "UseMultiVmSyncRecoveryPoint" USE_PER_VM_RECOVERY_POINT = "UsePerVmRecoveryPoint" -class PlannedFailoverStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The last planned failover status. - """ + +class PlannedFailoverStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The last planned failover status.""" SUCCEEDED = "Succeeded" FAILED = "Failed" CANCELLED = "Cancelled" UNKNOWN = "Unknown" -class PossibleOperationsDirections(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class PossibleOperationsDirections(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """PossibleOperationsDirections.""" PRIMARY_TO_RECOVERY = "PrimaryToRecovery" RECOVERY_TO_PRIMARY = "RecoveryToPrimary" -class PresenceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class PresenceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum. """ @@ -280,56 +292,57 @@ class PresenceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PRESENT = "Present" NOT_PRESENT = "NotPresent" -class ProtectionHealth(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The health. - """ + +class ProtectionHealth(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The health.""" NONE = "None" NORMAL = "Normal" WARNING = "Warning" CRITICAL = "Critical" -class RcmComponentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The throughput status. - """ + +class RcmComponentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The throughput status.""" HEALTHY = "Healthy" WARNING = "Warning" CRITICAL = "Critical" UNKNOWN = "Unknown" -class RecoveryPlanActionLocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The fabric location. - """ + +class RecoveryPlanActionLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The fabric location.""" PRIMARY = "Primary" RECOVERY = "Recovery" -class RecoveryPlanGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The group type. - """ + +class RecoveryPlanGroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The group type.""" SHUTDOWN = "Shutdown" BOOT = "Boot" FAILOVER = "Failover" -class RecoveryPlanPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The recovery point type. - """ + +class RecoveryPlanPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The recovery point type.""" LATEST = "Latest" LATEST_APPLICATION_CONSISTENT = "LatestApplicationConsistent" LATEST_CRASH_CONSISTENT = "LatestCrashConsistent" LATEST_PROCESSED = "LatestProcessed" -class RecoveryPointSyncType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """A value indicating whether the recovery point is multi VM consistent. - """ + +class RecoveryPointSyncType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating whether the recovery point is multi VM consistent.""" MULTI_VM_SYNC_RECOVERY_POINT = "MultiVmSyncRecoveryPoint" PER_VM_RECOVERY_POINT = "PerVmRecoveryPoint" -class RecoveryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class RecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery point type. Values from LatestTime, LatestTag or Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In the other two cases, recovery point id will be ignored. @@ -339,7 +352,9 @@ class RecoveryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LATEST_TAG = "LatestTag" CUSTOM = "Custom" -class ReplicationProtectedItemOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class ReplicationProtectedItemOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ReplicationProtectedItemOperation.""" REVERSE_REPLICATE = "ReverseReplicate" COMMIT = "Commit" @@ -356,23 +371,24 @@ class ReplicationProtectedItemOperation(with_metaclass(_CaseInsensitiveEnumMeta, SWITCH_PROTECTION = "SwitchProtection" COMPLETE_MIGRATION = "CompleteMigration" -class ResyncState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The resync state. - """ + +class ResyncState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The resync state.""" NONE = "None" PREPARED_FOR_RESYNCHRONIZATION = "PreparedForResynchronization" STARTED_RESYNCHRONIZATION = "StartedResynchronization" -class RpInMageRecoveryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The recovery point type. - """ + +class RpInMageRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The recovery point type.""" LATEST_TIME = "LatestTime" LATEST_TAG = "LatestTag" CUSTOM = "Custom" -class SetMultiVmSyncStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + +class SetMultiVmSyncStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. """ @@ -380,52 +396,54 @@ class SetMultiVmSyncStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLE = "Enable" DISABLE = "Disable" -class Severity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Severity of error. - """ + +class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Severity of error.""" NONE = "NONE" WARNING = "Warning" ERROR = "Error" INFO = "Info" -class SourceSiteOperations(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """A value indicating whether source site operations are required. - """ + +class SourceSiteOperations(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating whether source site operations are required.""" REQUIRED = "Required" NOT_REQUIRED = "NotRequired" -class SqlServerLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The SQL Server license type. - """ + +class SqlServerLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The SQL Server license type.""" NOT_SPECIFIED = "NotSpecified" NO_LICENSE_TYPE = "NoLicenseType" PAYG = "PAYG" AHUB = "AHUB" -class TestMigrationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The test migrate state. - """ + +class TestMigrationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The test migrate state.""" NONE = "None" TEST_MIGRATION_IN_PROGRESS = "TestMigrationInProgress" TEST_MIGRATION_SUCCEEDED = "TestMigrationSucceeded" TEST_MIGRATION_FAILED = "TestMigrationFailed" TEST_MIGRATION_CLEANUP_IN_PROGRESS = "TestMigrationCleanupInProgress" + TEST_MIGRATION_COMPLETED_WITH_INFORMATION = "TestMigrationCompletedWithInformation" + TEST_MIGRATION_PARTIALLY_SUCCEEDED = "TestMigrationPartiallySucceeded" -class VmEncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The encryption type of the VM. - """ + +class VmEncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The encryption type of the VM.""" NOT_ENCRYPTED = "NotEncrypted" ONE_PASS_ENCRYPTED = "OnePassEncrypted" TWO_PASS_ENCRYPTED = "TwoPassEncrypted" -class VmReplicationProgressHealth(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The initial replication progress health. - """ + +class VmReplicationProgressHealth(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The initial replication progress health.""" NONE = "None" IN_PROGRESS = "InProgress" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/__init__.py index baa6aa965187..8355227afed4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/__init__.py @@ -8,6 +8,7 @@ from ._operations import Operations from ._replication_alert_settings_operations import ReplicationAlertSettingsOperations +from ._replication_appliances_operations import ReplicationAppliancesOperations from ._replication_eligibility_results_operations import ReplicationEligibilityResultsOperations from ._replication_events_operations import ReplicationEventsOperations from ._replication_fabrics_operations import ReplicationFabricsOperations @@ -34,32 +35,39 @@ from ._replication_vault_health_operations import ReplicationVaultHealthOperations from ._replication_vault_setting_operations import ReplicationVaultSettingOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ReplicationAlertSettingsOperations', - 'ReplicationEligibilityResultsOperations', - 'ReplicationEventsOperations', - 'ReplicationFabricsOperations', - 'ReplicationLogicalNetworksOperations', - 'ReplicationNetworksOperations', - 'ReplicationNetworkMappingsOperations', - 'ReplicationProtectionContainersOperations', - 'ReplicationMigrationItemsOperations', - 'MigrationRecoveryPointsOperations', - 'ReplicationProtectableItemsOperations', - 'ReplicationProtectedItemsOperations', - 'RecoveryPointsOperations', - 'TargetComputeSizesOperations', - 'ReplicationProtectionContainerMappingsOperations', - 'ReplicationRecoveryServicesProvidersOperations', - 'ReplicationStorageClassificationsOperations', - 'ReplicationStorageClassificationMappingsOperations', - 'ReplicationvCentersOperations', - 'ReplicationJobsOperations', - 'ReplicationPoliciesOperations', - 'ReplicationProtectionIntentsOperations', - 'ReplicationRecoveryPlansOperations', - 'SupportedOperatingSystemsOperations', - 'ReplicationVaultHealthOperations', - 'ReplicationVaultSettingOperations', + "Operations", + "ReplicationAlertSettingsOperations", + "ReplicationAppliancesOperations", + "ReplicationEligibilityResultsOperations", + "ReplicationEventsOperations", + "ReplicationFabricsOperations", + "ReplicationLogicalNetworksOperations", + "ReplicationNetworksOperations", + "ReplicationNetworkMappingsOperations", + "ReplicationProtectionContainersOperations", + "ReplicationMigrationItemsOperations", + "MigrationRecoveryPointsOperations", + "ReplicationProtectableItemsOperations", + "ReplicationProtectedItemsOperations", + "RecoveryPointsOperations", + "TargetComputeSizesOperations", + "ReplicationProtectionContainerMappingsOperations", + "ReplicationRecoveryServicesProvidersOperations", + "ReplicationStorageClassificationsOperations", + "ReplicationStorageClassificationMappingsOperations", + "ReplicationvCentersOperations", + "ReplicationJobsOperations", + "ReplicationPoliciesOperations", + "ReplicationProtectionIntentsOperations", + "ReplicationRecoveryPlansOperations", + "SupportedOperatingSystemsOperations", + "ReplicationVaultHealthOperations", + "ReplicationVaultSettingOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py index 1f0caf914f06..222f0e88a03c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,107 +6,212 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +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 HttpRequest, HttpResponse +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_by_replication_migration_items_request( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migration_recovery_point_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_name, "str"), + "migrationRecoveryPointName": _SERIALIZER.url( + "migration_recovery_point_name", migration_recovery_point_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) + + +class MigrationRecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class MigrationRecoveryPointsOperations(object): - """MigrationRecoveryPointsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`migration_recovery_points` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_migration_items( - self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MigrationRecoveryPointCollection"] + self, fabric_name: str, protection_container_name: str, migration_item_name: str, **kwargs: Any + ) -> Iterable["_models.MigrationRecoveryPoint"]: """Gets the recovery points for a migration item. Gets the recovery points for a migration item. - :param fabric_name: Fabric unique name. + :param fabric_name: Fabric unique name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationRecoveryPointCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either MigrationRecoveryPoint or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationRecoveryPointCollection"] + _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.MigrationRecoveryPointCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_migration_items.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_migration_items_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_migration_items.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MigrationRecoveryPointCollection', pipeline_response) + deserialized = self._deserialize("MigrationRecoveryPointCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,7 +220,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -123,78 +231,81 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_migration_items.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints'} # type: ignore + return ItemPaged(get_next, extract_data) + list_by_replication_migration_items.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints"} # type: ignore + + @distributed_trace def get( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - migration_recovery_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MigrationRecoveryPoint" + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migration_recovery_point_name: str, + **kwargs: Any + ) -> _models.MigrationRecoveryPoint: """Gets a recovery point for a migration item. Gets a recovery point for a migration item. - :param fabric_name: Fabric unique name. + :param fabric_name: Fabric unique name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param migration_recovery_point_name: The migration recovery point name. + :param migration_recovery_point_name: The migration recovery point name. Required. :type migration_recovery_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationRecoveryPoint, or the result of cls(response) + :return: MigrationRecoveryPoint or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationRecoveryPoint"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - 'migrationRecoveryPointName': self._serialize.url("migration_recovery_point_name", migration_recovery_point_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.MigrationRecoveryPoint] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + migration_recovery_point_name=migration_recovery_point_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('MigrationRecoveryPoint', pipeline_response) + deserialized = self._deserialize("MigrationRecoveryPoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py index fcb02725c73a..1a90ac1134da 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,94 +6,143 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +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 HttpRequest, HttpResponse +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, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + accept = _headers.pop("Accept", "application/json") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } -class Operations(object): - """Operations operations. + _url = _format_url_section(_url, **path_format_arguments) - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsDiscoveryCollection"] + 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, **kwargs: Any) -> Iterable["_models.OperationsDiscovery"]: """Returns the list of available operations. Operation to return the list of available operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationsDiscoveryCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscoveryCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either OperationsDiscovery or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsDiscoveryCollection"] + _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.OperationsDiscoveryCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsDiscoveryCollection', pipeline_response) + deserialized = self._deserialize("OperationsDiscoveryCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,7 +151,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -110,7 +162,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py index 78d736b589bd..24c760953499 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,107 +6,213 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +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 HttpRequest, HttpResponse +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_by_replication_protected_items_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + recovery_point_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_name, "str" + ), + "recoveryPointName": _SERIALIZER.url("recovery_point_name", recovery_point_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) + + +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class RecoveryPointsOperations(object): - """RecoveryPointsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`recovery_points` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protected_items( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RecoveryPointCollection"] + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> Iterable["_models.RecoveryPoint"]: """Gets the list of recovery points for a replication protected item. Lists the available recovery points for a replication protected item. - :param fabric_name: The fabric name. + :param fabric_name: The fabric name. Required. :type fabric_name: str - :param protection_container_name: The protection container name. + :param protection_container_name: The protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: The replication protected item name. + :param replicated_protected_item_name: The replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RecoveryPoint or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointCollection"] + _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.RecoveryPointCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protected_items.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protected_items_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_protected_items.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RecoveryPointCollection', pipeline_response) + deserialized = self._deserialize("RecoveryPointCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,7 +221,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -123,78 +232,81 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_protected_items.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints'} # type: ignore + return ItemPaged(get_next, extract_data) + list_by_replication_protected_items.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints"} # type: ignore + + @distributed_trace def get( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - recovery_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RecoveryPoint" + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + recovery_point_name: str, + **kwargs: Any + ) -> _models.RecoveryPoint: """Gets a recovery point. Get the details of specified recovery point. - :param fabric_name: The fabric name. + :param fabric_name: The fabric name. Required. :type fabric_name: str - :param protection_container_name: The protection container name. + :param protection_container_name: The protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: The replication protected item name. + :param replicated_protected_item_name: The replication protected item name. Required. :type replicated_protected_item_name: str - :param recovery_point_name: The recovery point name. + :param recovery_point_name: The recovery point name. Required. :type recovery_point_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryPoint, or the result of cls(response) + :return: RecoveryPoint or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPoint"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - 'recoveryPointName': self._serialize.url("recovery_point_name", recovery_point_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.RecoveryPoint] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + recovery_point_name=recovery_point_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('RecoveryPoint', pipeline_response) + deserialized = self._deserialize("RecoveryPoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py index 2019db6e50a6..847fea9e43a7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,95 +6,213 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +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 HttpRequest, HttpResponse +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_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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) + + +def build_get_request( + alert_setting_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "alertSettingName": _SERIALIZER.url("alert_setting_name", alert_setting_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class ReplicationAlertSettingsOperations(object): - """ReplicationAlertSettingsOperations operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +def build_create_request( + alert_setting_name: str, resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "alertSettingName": _SERIALIZER.url("alert_setting_name", alert_setting_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) + + +class ReplicationAlertSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_alert_settings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AlertCollection"] + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: """Gets the list of configured email notification(alert) configurations. Gets the list of email notification(alert) configurations for the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AlertCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.AlertCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Alert or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Alert] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertCollection"] + _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.AlertCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertCollection', pipeline_response) + deserialized = self._deserialize("AlertCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,7 +221,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -111,133 +232,191 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - alert_setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings"} # type: ignore + + @distributed_trace + def get(self, alert_setting_name: str, **kwargs: Any) -> _models.Alert: """Gets an email notification(alert) configuration. Gets the details of the specified email notification(alert) configuration. - :param alert_setting_name: The name of the email notification configuration. + :param alert_setting_name: The name of the email notification configuration. Required. :type alert_setting_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert, or the result of cls(response) + :return: Alert or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Alert"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'alertSettingName': self._serialize.url("alert_setting_name", alert_setting_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Alert] + + request = build_get_request( + alert_setting_name=alert_setting_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('Alert', pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}'} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}"} # type: ignore + + @overload def create( self, - alert_setting_name, # type: str - request, # type: "_models.ConfigureAlertRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + alert_setting_name: str, + request: _models.ConfigureAlertRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Alert: """Configures email notifications for this vault. Create or update an email notification(alert) configuration. - :param alert_setting_name: The name of the email notification(alert) configuration. + :param alert_setting_name: The name of the email notification(alert) configuration. Required. :type alert_setting_name: str - :param request: The input to configure the email notification(alert). + :param request: The input to configure the email notification(alert). Required. :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest + :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: Alert or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, alert_setting_name: str, request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param alert_setting_name: The name of the email notification(alert) configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Required. + :type request: 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: Alert, or the result of cls(response) + :return: Alert or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, alert_setting_name: str, request: Union[_models.ConfigureAlertRequest, IO], **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param alert_setting_name: The name of the email notification(alert) configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Is either a model type or + a IO type. Required. + :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest 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: Alert or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Alert"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'alertSettingName': self._serialize.url("alert_setting_name", alert_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(request, 'ConfigureAlertRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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.Alert] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request, (IO, bytes)): + _content = request + else: + _json = self._serialize.body(request, "ConfigureAlertRequest") + + request = build_create_request( + alert_setting_name=alert_setting_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.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('Alert', pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}'} # type: ignore + + create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py new file mode 100644 index 000000000000..8eec5c70507b --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py @@ -0,0 +1,177 @@ +# 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 +import urllib.parse + +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_name: str, resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ReplicationAppliancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_appliances` 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, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ReplicationAppliance"]: + """Gets the list of appliances. + + Gets the list of Azure Site Recovery appliances for the vault. + + :param filter: OData filter options. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ReplicationAppliance or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] + :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.ApplianceCollection] + + 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_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _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", 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.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplianceCollection", 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.RecoveryServices/vaults/{resourceName}/replicationAppliances"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py index e133f0e83691..4821f6f74e60 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,157 +6,227 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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( + virtual_machine_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_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( + virtual_machine_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + _url = _format_url_section(_url, **path_format_arguments) -class ReplicationEligibilityResultsOperations(object): - """ReplicationEligibilityResultsOperations operations. + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ReplicationEligibilityResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_eligibility_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - virtual_machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ReplicationEligibilityResultsCollection" + 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, virtual_machine_name: str, **kwargs: Any) -> _models.ReplicationEligibilityResultsCollection: """Gets the validation errors in case the VM is unsuitable for protection. Validates whether a given VM can be protected or not in which case returns list of errors. - :param virtual_machine_name: Virtual Machine name. + :param virtual_machine_name: Virtual Machine name. Required. :type virtual_machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationEligibilityResultsCollection, or the result of cls(response) + :return: ReplicationEligibilityResultsCollection or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsCollection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationEligibilityResultsCollection"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ReplicationEligibilityResultsCollection] + + request = build_list_request( + virtual_machine_name=virtual_machine_name, + resource_group_name=self._config.resource_group_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 + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('ReplicationEligibilityResultsCollection', pipeline_response) + deserialized = self._deserialize("ReplicationEligibilityResultsCollection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults'} # type: ignore - - def get( - self, - virtual_machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ReplicationEligibilityResults" + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults"} # type: ignore + + @distributed_trace + def get(self, virtual_machine_name: str, **kwargs: Any) -> _models.ReplicationEligibilityResults: """Gets the validation errors in case the VM is unsuitable for protection. Validates whether a given VM can be protected or not in which case returns list of errors. - :param virtual_machine_name: Virtual Machine name. + :param virtual_machine_name: Virtual Machine name. Required. :type virtual_machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationEligibilityResults, or the result of cls(response) + :return: ReplicationEligibilityResults or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationEligibilityResults"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + 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.ReplicationEligibilityResults] + + request = build_get_request( + virtual_machine_name=virtual_machine_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('ReplicationEligibilityResults', pipeline_response) + deserialized = self._deserialize("ReplicationEligibilityResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py index 18bd5de7871a..b6e2760a70ee 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,183 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +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 HttpRequest, HttpResponse +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_name: str, resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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( + event_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "eventName": _SERIALIZER.url("event_name", event_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") -class ReplicationEventsOperations(object): - """ReplicationEventsOperations operations. + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. +class ReplicationEventsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_events` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventCollection"] + 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, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Event"]: """Gets the list of Azure Site Recovery events. Gets the list of Azure Site Recovery events for the vault. - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.EventCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Event or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Event] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EventCollection"] + _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.EventCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventCollection', pipeline_response) + deserialized = self._deserialize("EventCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,7 +191,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -116,66 +202,65 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents'} # type: ignore - - def get( - self, - event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Event" + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents"} # type: ignore + + @distributed_trace + def get(self, event_name: str, **kwargs: Any) -> _models.Event: """Get the details of an Azure Site recovery event. The operation to get the details of an Azure Site recovery event. - :param event_name: The name of the Azure Site Recovery event. + :param event_name: The name of the Azure Site Recovery event. Required. :type event_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Event, or the result of cls(response) + :return: Event or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Event - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Event"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'eventName': self._serialize.url("event_name", event_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Event] + + request = build_get_request( + event_name=event_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('Event', pipeline_response) + deserialized = self._deserialize("Event", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py index 63d4f5712439..48758437e4c4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,97 +6,403 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +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_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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) + + +def build_get_request( + fabric_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + fabric_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_purge_request( + fabric_name: str, resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_check_consistency_request( + fabric_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_migrate_to_aad_request( + fabric_name: str, resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_reassociate_gateway_request( + fabric_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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) + + +def build_delete_request( + fabric_name: str, resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_renew_certificate_request( + fabric_name: str, resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -class ReplicationFabricsOperations(object): - """ReplicationFabricsOperations operations. + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + # 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 ReplicationFabricsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_fabrics` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FabricCollection"] + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Fabric"]: """Gets the list of ASR fabrics. Gets a list of the Azure Site Recovery fabrics in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FabricCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.FabricCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Fabric or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.FabricCollection"] + _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.FabricCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FabricCollection', pipeline_response) + deserialized = self._deserialize("FabricCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,7 +411,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -113,115 +422,118 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - fabric_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Fabric" + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics"} # type: ignore + + @distributed_trace + def get(self, fabric_name: str, filter: Optional[str] = None, **kwargs: Any) -> _models.Fabric: """Gets the details of an ASR fabric. Gets the details of an Azure Site Recovery fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Fabric, or the result of cls(response) + :return: Fabric or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Fabric - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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.Fabric] + + request = build_get_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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 - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore def _create_initial( - self, - fabric_name, # type: str - input, # type: "_models.FabricCreationInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Fabric"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Fabric"]] + self, fabric_name: str, input: Union[_models.FabricCreationInput, IO], **kwargs: Any + ) -> Optional[_models.Fabric]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'FabricCreationInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Fabric]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "FabricCreationInput") + + request = build_create_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -230,117 +542,180 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore + + @overload def begin_create( self, - fabric_name, # type: str - input, # type: "_models.FabricCreationInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Fabric"] + fabric_name: str, + input: _models.FabricCreationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: """Creates an Azure Site Recovery fabric. The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). - :param fabric_name: Name of the ASR fabric. + :param fabric_name: Name of the ASR fabric. Required. :type fabric_name: str - :param input: Fabric creation input. + :param input: Fabric creation input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Fabric or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, fabric_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param fabric_name: Name of the ASR fabric. Required. + :type fabric_name: str + :param input: Fabric creation input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fabric or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, fabric_name: str, input: Union[_models.FabricCreationInput, IO], **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param fabric_name: Name of the ASR fabric. Required. + :type fabric_name: str + :param input: Fabric creation input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fabric or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Fabric] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore fabric_name=fabric_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fabric', pipeline_response) - + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _purge_initial( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore + + def _purge_initial(self, fabric_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_purge_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -350,106 +725,100 @@ def _purge_initial( if cls: return cls(pipeline_response, None, {}) - _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore - def begin_purge( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + @distributed_trace + def begin_purge(self, fabric_name: str, **kwargs: Any) -> LROPoller[None]: """Purges the site. The operation to purge(force delete) an Azure Site Recovery fabric. - :param fabric_name: ASR fabric to purge. + :param fabric_name: ASR fabric to purge. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_initial( + raw_result = self._purge_initial( # type: ignore fabric_name=fabric_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _check_consistency_initial( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Fabric"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Fabric"]] + begin_purge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"} # type: ignore + + def _check_consistency_initial(self, fabric_name: str, **kwargs: Any) -> Optional[_models.Fabric]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._check_consistency_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.Fabric]] + + request = build_check_consistency_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._check_consistency_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -458,113 +827,111 @@ def _check_consistency_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _check_consistency_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency'} # type: ignore - def begin_check_consistency( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Fabric"] + _check_consistency_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency"} # type: ignore + + @distributed_trace + def begin_check_consistency(self, fabric_name: str, **kwargs: Any) -> LROPoller[_models.Fabric]: """Checks the consistency of the ASR fabric. The operation to perform a consistency check on the fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Fabric or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fabric] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._check_consistency_initial( + raw_result = self._check_consistency_initial( # type: ignore fabric_name=fabric_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fabric', pipeline_response) - + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_check_consistency.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _migrate_to_aad_initial( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_check_consistency.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency"} # type: ignore + + def _migrate_to_aad_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._migrate_to_aad_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_migrate_to_aad_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._migrate_to_aad_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -574,112 +941,117 @@ def _migrate_to_aad_initial( if cls: return cls(pipeline_response, None, {}) - _migrate_to_aad_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad'} # type: ignore + _migrate_to_aad_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad"} # type: ignore - def begin_migrate_to_aad( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + @distributed_trace + def begin_migrate_to_aad(self, fabric_name: str, **kwargs: Any) -> LROPoller[None]: """Migrates the site to AAD. The operation to migrate an Azure Site Recovery fabric to AAD. - :param fabric_name: ASR fabric to migrate. + :param fabric_name: ASR fabric to migrate. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_to_aad_initial( + raw_result = self._migrate_to_aad_initial( # type: ignore fabric_name=fabric_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate_to_aad.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_migrate_to_aad.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad"} # type: ignore def _reassociate_gateway_initial( self, - fabric_name, # type: str - failover_process_server_request, # type: "_models.FailoverProcessServerRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Fabric"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Fabric"]] + fabric_name: str, + failover_process_server_request: Union[_models.FailoverProcessServerRequest, IO], + **kwargs: Any + ) -> Optional[_models.Fabric]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reassociate_gateway_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(failover_process_server_request, 'FailoverProcessServerRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Fabric]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(failover_process_server_request, (IO, bytes)): + _content = failover_process_server_request + else: + _json = self._serialize.body(failover_process_server_request, "FailoverProcessServerRequest") + + request = build_reassociate_gateway_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reassociate_gateway_initial.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, 202]: @@ -688,117 +1060,195 @@ def _reassociate_gateway_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _reassociate_gateway_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway'} # type: ignore + _reassociate_gateway_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway"} # type: ignore + + @overload def begin_reassociate_gateway( self, - fabric_name, # type: str - failover_process_server_request, # type: "_models.FailoverProcessServerRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Fabric"] + fabric_name: str, + failover_process_server_request: _models.FailoverProcessServerRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: """Perform failover of the process server. The operation to move replications from a process server to another process server. - :param fabric_name: The name of the fabric containing the process server. + :param fabric_name: The name of the fabric containing the process server. Required. :type fabric_name: str :param failover_process_server_request: The input to the failover process server operation. - :type failover_process_server_request: ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest + Required. + :type failover_process_server_request: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Fabric or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_reassociate_gateway( + self, + fabric_name: str, + failover_process_server_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param fabric_name: The name of the fabric containing the process server. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. + Required. + :type failover_process_server_request: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fabric or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reassociate_gateway( + self, + fabric_name: str, + failover_process_server_request: Union[_models.FailoverProcessServerRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param fabric_name: The name of the fabric containing the process server. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. Is + either a model type or a IO type. Required. + :type failover_process_server_request: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fabric or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Fabric] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._reassociate_gateway_initial( + raw_result = self._reassociate_gateway_initial( # type: ignore fabric_name=fabric_name, failover_process_server_request=failover_process_server_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fabric', pipeline_response) - + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reassociate_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_reassociate_gateway.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -808,112 +1258,114 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove"} # type: ignore - def begin_delete( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + @distributed_trace + def begin_delete(self, fabric_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes the site. The operation to delete or remove an Azure Site Recovery fabric. - :param fabric_name: ASR fabric to delete. + :param fabric_name: ASR fabric to delete. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore fabric_name=fabric_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove"} # type: ignore def _renew_certificate_initial( - self, - fabric_name, # type: str - renew_certificate, # type: "_models.RenewCertificateInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Fabric"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Fabric"]] + self, fabric_name: str, renew_certificate: Union[_models.RenewCertificateInput, IO], **kwargs: Any + ) -> Optional[_models.Fabric]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._renew_certificate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(renew_certificate, 'RenewCertificateInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Fabric]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(renew_certificate, (IO, bytes)): + _content = renew_certificate + else: + _json = self._serialize.body(renew_certificate, "RenewCertificateInput") + + request = build_renew_certificate_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._renew_certificate_initial.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, 202]: @@ -922,81 +1374,146 @@ def _renew_certificate_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Fabric', pipeline_response) + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _renew_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate'} # type: ignore + _renew_certificate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate"} # type: ignore + + @overload def begin_renew_certificate( self, - fabric_name, # type: str - renew_certificate, # type: "_models.RenewCertificateInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Fabric"] + fabric_name: str, + renew_certificate: _models.RenewCertificateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: """Renews certificate for the fabric. Renews the connection certificate for the ASR replication fabric. - :param fabric_name: fabric name to renew certs for. + :param fabric_name: fabric name to renew certs for. Required. :type fabric_name: str - :param renew_certificate: Renew certificate input. + :param renew_certificate: Renew certificate input. Required. :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Fabric or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Fabric"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_renew_certificate( + self, fabric_name: str, renew_certificate: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param fabric_name: fabric name to renew certs for. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Required. + :type renew_certificate: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fabric or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_renew_certificate( + self, fabric_name: str, renew_certificate: Union[_models.RenewCertificateInput, IO], **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param fabric_name: fabric name to renew certs for. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Is either a model type or a IO type. + Required. + :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fabric or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Fabric] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._renew_certificate_initial( + raw_result = self._renew_certificate_initial( # type: ignore fabric_name=fabric_name, renew_certificate=renew_certificate, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fabric', pipeline_response) - + deserialized = self._deserialize("Fabric", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_renew_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_renew_certificate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py index c693bf8e175b..872f82bc1998 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,102 +6,318 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +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_name: str, resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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( + job_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "jobName": _SERIALIZER.url("job_name", job_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_cancel_request( + job_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "jobName": _SERIALIZER.url("job_name", job_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restart_request( + job_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "jobName": _SERIALIZER.url("job_name", job_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") -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class ReplicationJobsOperations(object): - """ReplicationJobsOperations operations. +def build_resume_request( + job_name: str, resource_name: str, resource_group_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-10")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + } - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _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) + + +def build_export_request( + resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationJobs/export", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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 ReplicationJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.JobCollection"] + @distributed_trace + def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Job"]: """Gets the list of jobs. Gets the list of Azure Site Recovery Jobs for the vault. - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.JobCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Job or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollection"] + _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.JobCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('JobCollection', pipeline_response) + deserialized = self._deserialize("JobCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,7 +326,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -118,104 +337,101 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs"} # type: ignore + + @distributed_trace + def get(self, job_name: str, **kwargs: Any) -> _models.Job: """Gets the job details. Get the details of an Azure Site Recovery job. - :param job_name: Job identifier. + :param job_name: Job identifier. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Job, or the result of cls(response) + :return: Job or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Job - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Job] + + request = build_get_request( + job_name=job_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}'} # type: ignore - def _cancel_initial( - self, - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Job"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}"} # type: ignore + + def _cancel_initial(self, job_name: str, **kwargs: Any) -> Optional[_models.Job]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.Job]] + + request = build_cancel_request( + job_name=job_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._cancel_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -224,115 +440,109 @@ def _cancel_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel'} # type: ignore - def begin_cancel( - self, - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Job"] + _cancel_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel"} # type: ignore + + @distributed_trace + def begin_cancel(self, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: """Cancels the specified job. The operation to cancel an Azure Site Recovery job. - :param job_name: Job identifier. + :param job_name: Job identifier. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._cancel_initial( + raw_result = self._cancel_initial( # type: ignore job_name=job_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Job', pipeline_response) - + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _restart_initial( - self, - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Job"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + begin_cancel.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel"} # type: ignore + + def _restart_initial(self, job_name: str, **kwargs: Any) -> Optional[_models.Job]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.Job]] + + request = build_restart_request( + job_name=job_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._restart_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -341,121 +551,123 @@ def _restart_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart'} # type: ignore - def begin_restart( - self, - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Job"] + _restart_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart"} # type: ignore + + @distributed_trace + def begin_restart(self, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: """Restarts the specified job. The operation to restart an Azure Site Recovery job. - :param job_name: Job identifier. + :param job_name: Job identifier. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._restart_initial( + raw_result = self._restart_initial( # type: ignore job_name=job_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Job', pipeline_response) - + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart"} # type: ignore def _resume_initial( - self, - job_name, # type: str - resume_job_params, # type: "_models.ResumeJobParams" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Job"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + self, job_name: str, resume_job_params: Union[_models.ResumeJobParams, IO], **kwargs: Any + ) -> Optional[_models.Job]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._resume_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resume_job_params, 'ResumeJobParams') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Job]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resume_job_params, (IO, bytes)): + _content = resume_job_params + else: + _json = self._serialize.body(resume_job_params, "ResumeJobParams") + + request = build_resume_request( + job_name=job_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resume_initial.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, 202]: @@ -464,123 +676,193 @@ def _resume_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume'} # type: ignore + _resume_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume"} # type: ignore + + @overload def begin_resume( self, - job_name, # type: str - resume_job_params, # type: "_models.ResumeJobParams" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Job"] + job_name: str, + resume_job_params: _models.ResumeJobParams, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Job]: """Resumes the specified job. The operation to resume an Azure Site Recovery job. - :param job_name: Job identifier. + :param job_name: Job identifier. Required. :type job_name: str - :param resume_job_params: Resume rob comments. + :param resume_job_params: Resume rob comments. Required. :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_resume( + self, job_name: str, resume_job_params: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Required. + :type resume_job_params: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resume( + self, job_name: str, resume_job_params: Union[_models.ResumeJobParams, IO], **kwargs: Any + ) -> LROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Is either a model type or a IO type. Required. + :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Job] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._resume_initial( + raw_result = self._resume_initial( # type: ignore job_name=job_name, resume_job_params=resume_job_params, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Job', pipeline_response) - + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'jobName': self._serialize.url("job_name", job_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume"} # type: ignore def _export_initial( - self, - job_query_parameter, # type: "_models.JobQueryParameter" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Job"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + self, job_query_parameter: Union[_models.JobQueryParameter, IO], **kwargs: Any + ) -> Optional[_models.Job]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._export_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(job_query_parameter, 'JobQueryParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Job]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_query_parameter, (IO, bytes)): + _content = job_query_parameter + else: + _json = self._serialize.body(job_query_parameter, "JobQueryParameter") + + request = build_export_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._export_initial.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, 202]: @@ -589,76 +871,133 @@ def _export_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Job', pipeline_response) + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _export_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export'} # type: ignore + _export_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export"} # type: ignore + + @overload def begin_export( - self, - job_query_parameter, # type: "_models.JobQueryParameter" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Job"] + self, job_query_parameter: _models.JobQueryParameter, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.Job]: """Exports the details of the Azure Site Recovery jobs of the vault. The operation to export the details of the Azure Site Recovery jobs of the vault. - :param job_query_parameter: job query filter. + :param job_query_parameter: job query filter. Required. :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_export( + self, job_query_parameter: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param job_query_parameter: job query filter. Required. + :type job_query_parameter: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_export( + self, job_query_parameter: Union[_models.JobQueryParameter, IO], **kwargs: Any + ) -> LROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param job_query_parameter: job query filter. Is either a model type or a IO type. Required. + :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Job] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._export_initial( + raw_result = self._export_initial( # type: ignore job_query_parameter=job_query_parameter, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Job', pipeline_response) - + deserialized = self._deserialize("Job", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_export.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py index ea40311d1381..5dee7cb62dc7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,99 +6,189 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +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 HttpRequest, HttpResponse +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_by_replication_fabrics_request( + fabric_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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( + fabric_name: str, + logical_network_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "logicalNetworkName": _SERIALIZER.url("logical_network_name", logical_network_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") -class ReplicationLogicalNetworksOperations(object): - """ReplicationLogicalNetworksOperations operations. + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. +class ReplicationLogicalNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_logical_networks` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_replication_fabrics( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.LogicalNetworkCollection"] + 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_by_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.LogicalNetwork"]: """Gets the list of logical networks under a fabric. Lists all the logical networks of the Azure Site Recovery fabric. - :param fabric_name: Server Id. + :param fabric_name: Server Id. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LogicalNetworkCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either LogicalNetwork or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LogicalNetworkCollection"] + _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.LogicalNetworkCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('LogicalNetworkCollection', pipeline_response) + deserialized = self._deserialize("LogicalNetworkCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,7 +197,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -115,70 +208,68 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks'} # type: ignore - - def get( - self, - fabric_name, # type: str - logical_network_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.LogicalNetwork" + return ItemPaged(get_next, extract_data) + + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks"} # type: ignore + + @distributed_trace + def get(self, fabric_name: str, logical_network_name: str, **kwargs: Any) -> _models.LogicalNetwork: """Gets a logical network with specified server id and logical network name. Gets the details of a logical network. - :param fabric_name: Server Id. + :param fabric_name: Server Id. Required. :type fabric_name: str - :param logical_network_name: Logical network name. + :param logical_network_name: Logical network name. Required. :type logical_network_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogicalNetwork, or the result of cls(response) + :return: LogicalNetwork or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LogicalNetwork"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'logicalNetworkName': self._serialize.url("logical_network_name", logical_network_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.LogicalNetwork] + + request = build_get_request( + fabric_name=fabric_name, + logical_network_name=logical_network_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('LogicalNetwork', pipeline_response) + deserialized = self._deserialize("LogicalNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py index 0cda240e18c6..07e914527f2e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,120 +6,655 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_replication_protection_containers_request( + fabric_name: str, + protection_container_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if take_token is not None: + _params["takeToken"] = _SERIALIZER.query("take_token", take_token, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_create_request( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + *, + delete_option: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if delete_option is not None: + _params["deleteOption"] = _SERIALIZER.query("delete_option", delete_option, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_update_request( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_migrate_request( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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) + + +def build_pause_replication_request( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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) + + +def build_resume_replication_request( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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) + + +def build_resync_request( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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) + + +def build_test_migrate_request( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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) + + +def build_test_migrate_cleanup_request( + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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) + + +def build_list_request( + resource_name: str, + resource_group_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if take_token is not None: + _params["takeToken"] = _SERIALIZER.query("take_token", take_token, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ReplicationMigrationItemsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationMigrationItemsOperations(object): - """ReplicationMigrationItemsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_migration_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protection_containers( self, - fabric_name, # type: str - protection_container_name, # type: str - skip_token=None, # type: Optional[str] - take_token=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MigrationItemCollection"] + fabric_name: str, + protection_container_name: str, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.MigrationItem"]: """Gets the list of migration items in the protection container. Gets the list of ASR migration items in the protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param skip_token: The pagination token. + :param skip_token: The pagination token. Default value is None. :type skip_token: str - :param take_token: The page size. + :param take_token: The page size. Default value is None. :type take_token: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationItemCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either MigrationItem or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItemCollection"] + _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.MigrationItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protection_containers.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if take_token is not None: - query_parameters['takeToken'] = self._serialize.query("take_token", take_token, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protection_containers_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + filter=filter, + api_version=api_version, + template_url=self.list_by_replication_protection_containers.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MigrationItemCollection', pipeline_response) + deserialized = self._deserialize("MigrationItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,7 +663,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -136,122 +674,130 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_protection_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems'} # type: ignore + return ItemPaged(get_next, extract_data) + list_by_replication_protection_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems"} # type: ignore + + @distributed_trace def get( - self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MigrationItem" + self, fabric_name: str, protection_container_name: str, migration_item_name: str, **kwargs: Any + ) -> _models.MigrationItem: """Gets the details of a migration item. Gets the details of a migration item. - :param fabric_name: Fabric unique name. + :param fabric_name: Fabric unique name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MigrationItem, or the result of cls(response) + :return: MigrationItem or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.MigrationItem] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore def _create_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - input, # type: "_models.EnableMigrationInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MigrationItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.EnableMigrationInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'EnableMigrationInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "EnableMigrationInput") + + request = build_create_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -260,134 +806,224 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore + + @overload def begin_create( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - input, # type: "_models.EnableMigrationInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MigrationItem"] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.EnableMigrationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: """Enables migration. The operation to create an ASR migration item (enable migration). - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param input: Enable migration input. + :param input: Enable migration input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.EnableMigrationInput, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - delete_option=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + delete_option: Optional[str] = None, + **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if delete_option is not None: - query_parameters['deleteOption'] = self._serialize.query("delete_option", delete_option, 'str') + 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( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + delete_option=delete_option, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -397,130 +1033,137 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore + @distributed_trace def begin_delete( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - delete_option=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + delete_option: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: """Delete the migration item. The operation to delete an ASR migration item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param delete_option: The delete option. + :param delete_option: The delete option. Default value is None. :type delete_option: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, delete_option=delete_option, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore def _update_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - input, # type: "_models.UpdateMigrationItemInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MigrationItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.UpdateMigrationItemInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'UpdateMigrationItemInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "UpdateMigrationItemInput") + + request = build_update_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -529,139 +1172,235 @@ def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore + + @overload def begin_update( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - input, # type: "_models.UpdateMigrationItemInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MigrationItem"] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.UpdateMigrationItemInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: """Updates migration item. The operation to update the recovery settings of an ASR migration item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param input: Update migration item input. + :param input: Update migration item input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.UpdateMigrationItemInput, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"} # type: ignore def _migrate_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - migrate_input, # type: "_models.MigrateInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MigrationItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: Union[_models.MigrateInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._migrate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(migrate_input, 'MigrateInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(migrate_input, (IO, bytes)): + _content = migrate_input + else: + _json = self._serialize.body(migrate_input, "MigrateInput") + + request = build_migrate_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._migrate_initial.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, 202]: @@ -670,139 +1409,715 @@ def _migrate_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _migrate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate'} # type: ignore + _migrate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate"} # type: ignore + + @overload def begin_migrate( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - migrate_input, # type: "_models.MigrateInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MigrationItem"] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: _models.MigrateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: """Migrate item. The operation to initiate migration of the item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param migrate_input: Migrate input. + :param migrate_input: Migrate input. Required. :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_migrate( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Required. + :type migrate_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_migrate( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: Union[_models.MigrateInput, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Is either a model type or a IO type. Required. + :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._migrate_initial( + raw_result = self._migrate_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, migrate_input=migrate_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_migrate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate"} # type: ignore + + def _pause_replication_initial( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: Union[_models.PauseReplicationInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pause_replication_input, (IO, bytes)): + _content = pause_replication_input + else: + _json = self._serialize.body(pause_replication_input, "PauseReplicationInput") + + request = build_pause_replication_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._pause_replication_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MigrationItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _pause_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication"} # type: ignore + + @overload + def begin_pause_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: _models.PauseReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_pause_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + @distributed_trace + def begin_pause_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: Union[_models.PauseReplicationInput, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Is either a model type or a IO type. + Required. + :type pause_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._pause_replication_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + pause_replication_input=pause_replication_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MigrationItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_pause_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication"} # type: ignore + + def _resume_replication_initial( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: Union[_models.ResumeReplicationInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resume_replication_input, (IO, bytes)): + _content = resume_replication_input + else: + _json = self._serialize.body(resume_replication_input, "ResumeReplicationInput") + + request = build_resume_replication_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resume_replication_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MigrationItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _resume_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication"} # type: ignore + + @overload + def begin_resume_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: _models.ResumeReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resume_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resume_replication( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: Union[_models.ResumeReplicationInput, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Is either a model type or a IO type. + Required. + :type resume_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._resume_replication_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resume_replication_input=resume_replication_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MigrationItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate'} # type: ignore + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication"} # type: ignore def _resync_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - input, # type: "_models.ResyncInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MigrationItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.ResyncInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._resync_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'ResyncInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "ResyncInput") + + request = build_resync_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resync_initial.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, 202]: @@ -811,139 +2126,235 @@ def _resync_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _resync_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync'} # type: ignore + _resync_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync"} # type: ignore + + @overload def begin_resync( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - input, # type: "_models.ResyncInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MigrationItem"] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.ResyncInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: """Resynchronizes replication. The operation to resynchronize replication of an ASR migration item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param input: Resync input. + :param input: Resync input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_resync( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resync( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.ResyncInput, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._resync_initial( + raw_result = self._resync_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_resync.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resync.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync"} # type: ignore def _test_migrate_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - test_migrate_input, # type: "_models.TestMigrateInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MigrationItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: Union[_models.TestMigrateInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_migrate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(test_migrate_input, 'TestMigrateInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(test_migrate_input, (IO, bytes)): + _content = test_migrate_input + else: + _json = self._serialize.body(test_migrate_input, "TestMigrateInput") + + request = build_test_migrate_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_migrate_initial.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, 202]: @@ -952,139 +2363,236 @@ def _test_migrate_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_migrate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate'} # type: ignore + _test_migrate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate"} # type: ignore + + @overload def begin_test_migrate( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - test_migrate_input, # type: "_models.TestMigrateInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MigrationItem"] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: _models.TestMigrateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: """Test migrate item. The operation to initiate test migration of the item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param test_migrate_input: Test migrate input. + :param test_migrate_input: Test migrate input. Required. :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_test_migrate( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Required. + :type test_migrate_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_migrate( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: Union[_models.TestMigrateInput, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Is either a model type or a IO type. Required. + :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._test_migrate_initial( + raw_result = self._test_migrate_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, test_migrate_input=test_migrate_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_migrate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate"} # type: ignore def _test_migrate_cleanup_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - test_migrate_cleanup_input, # type: "_models.TestMigrateCleanupInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MigrationItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationItem"]] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, IO], + **kwargs: Any + ) -> Optional[_models.MigrationItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_migrate_cleanup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(test_migrate_cleanup_input, 'TestMigrateCleanupInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.MigrationItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(test_migrate_cleanup_input, (IO, bytes)): + _content = test_migrate_cleanup_input + else: + _json = self._serialize.body(test_migrate_cleanup_input, "TestMigrateCleanupInput") + + request = build_test_migrate_cleanup_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_migrate_cleanup_initial.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, 202]: @@ -1093,159 +2601,261 @@ def _test_migrate_cleanup_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MigrationItem', pipeline_response) + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_migrate_cleanup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup'} # type: ignore + _test_migrate_cleanup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup"} # type: ignore + + @overload def begin_test_migrate_cleanup( self, - fabric_name, # type: str - protection_container_name, # type: str - migration_item_name, # type: str - test_migrate_cleanup_input, # type: "_models.TestMigrateCleanupInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MigrationItem"] + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: _models.TestMigrateCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: """Test migrate cleanup. The operation to initiate test migrate cleanup. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param migration_item_name: Migration item name. + :param migration_item_name: Migration item name. Required. :type migration_item_name: str - :param test_migrate_cleanup_input: Test migrate cleanup input. - :type test_migrate_cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MigrationItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_test_migrate_cleanup( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_migrate_cleanup( + self, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, IO], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Is either a model type or a IO + type. Required. + :type test_migrate_cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.MigrationItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._test_migrate_cleanup_initial( + raw_result = self._test_migrate_cleanup_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, migration_item_name=migration_item_name, test_migrate_cleanup_input=test_migrate_cleanup_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('MigrationItem', pipeline_response) - + deserialized = self._deserialize("MigrationItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'migrationItemName': self._serialize.url("migration_item_name", migration_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_migrate_cleanup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_migrate_cleanup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup"} # type: ignore + @distributed_trace def list( self, - skip_token=None, # type: Optional[str] - take_token=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MigrationItemCollection"] + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.MigrationItem"]: """Gets the list of migration items in the vault. Gets the list of migration items in the vault. - :param skip_token: The pagination token. + :param skip_token: The pagination token. Default value is None. :type skip_token: str - :param take_token: The page size. + :param take_token: The page size. Default value is None. :type take_token: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MigrationItemCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either MigrationItem or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationItemCollection"] + _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.MigrationItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if take_token is not None: - query_parameters['takeToken'] = self._serialize.query("take_token", take_token, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MigrationItemCollection', pipeline_response) + deserialized = self._deserialize("MigrationItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1254,7 +2864,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1263,7 +2875,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py index b1eb41ba95cc..3ba8f2ba4d04 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,105 +6,355 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_replication_networks_request( + fabric_name: str, + network_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_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( + fabric_name: str, + network_name: str, + network_mapping_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_name, "str"), + "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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_create_request( + fabric_name: str, + network_name: str, + network_mapping_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_name, "str"), + "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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( + fabric_name: str, + network_name: str, + network_mapping_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_name, "str"), + "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_update_request( + fabric_name: str, + network_name: str, + network_mapping_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_name, "str"), + "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 ReplicationNetworkMappingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationNetworkMappingsOperations(object): - """ReplicationNetworkMappingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_network_mappings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_networks( - self, - fabric_name, # type: str - network_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkMappingCollection"] + self, fabric_name: str, network_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkMapping"]: """Gets all the network mappings under a network. Lists all ASR network mappings for the specified network. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkMappingCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either NetworkMapping or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMappingCollection"] + _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.NetworkMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_networks.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_networks_request( + fabric_name=fabric_name, + network_name=network_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_networks.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkMappingCollection', pipeline_response) + deserialized = self._deserialize("NetworkMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,7 +363,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -121,122 +374,130 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_networks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings'} # type: ignore + return ItemPaged(get_next, extract_data) + + list_by_replication_networks.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings"} # type: ignore + @distributed_trace def get( - self, - fabric_name, # type: str - network_name, # type: str - network_mapping_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkMapping" + self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any + ) -> _models.NetworkMapping: """Gets network mapping by name. Gets the details of an ASR network mapping. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str - :param network_mapping_name: Network mapping name. + :param network_mapping_name: Network mapping name. Required. :type network_mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkMapping, or the result of cls(response) + :return: NetworkMapping or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMapping"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.NetworkMapping] + + request = build_get_request( + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('NetworkMapping', pipeline_response) + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore def _create_initial( self, - fabric_name, # type: str - network_name, # type: str - network_mapping_name, # type: str - input, # type: "_models.CreateNetworkMappingInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.NetworkMapping"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NetworkMapping"]] + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.CreateNetworkMappingInput, IO], + **kwargs: Any + ) -> Optional[_models.NetworkMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CreateNetworkMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.NetworkMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "CreateNetworkMappingInput") + + request = build_create_request( + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -245,131 +506,218 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NetworkMapping', pipeline_response) + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + + @overload def begin_create( self, - fabric_name, # type: str - network_name, # type: str - network_mapping_name, # type: str - input, # type: "_models.CreateNetworkMappingInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.NetworkMapping"] + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: _models.CreateNetworkMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: """Creates network mapping. The operation to create an ASR network mapping. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str - :param network_mapping_name: Network mapping name. + :param network_mapping_name: Network mapping name. Required. :type network_mapping_name: str - :param input: Create network mapping input. + :param input: Create network mapping input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either NetworkMapping or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param fabric_name: Primary fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.CreateNetworkMappingInput, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param fabric_name: Primary fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.NetworkMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore fabric_name=fabric_name, network_name=network_name, network_mapping_name=network_mapping_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('NetworkMapping', pipeline_response) - + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( - self, - fabric_name, # type: str - network_name, # type: str - network_mapping_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -379,126 +727,129 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + @distributed_trace def begin_delete( - self, - fabric_name, # type: str - network_name, # type: str - network_mapping_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any + ) -> LROPoller[None]: """Delete network mapping. The operation to delete a network mapping. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str - :param network_mapping_name: ARM Resource Name for network mapping. + :param network_mapping_name: ARM Resource Name for network mapping. Required. :type network_mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore fabric_name=fabric_name, network_name=network_name, network_mapping_name=network_mapping_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore def _update_initial( self, - fabric_name, # type: str - network_name, # type: str - network_mapping_name, # type: str - input, # type: "_models.UpdateNetworkMappingInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.NetworkMapping"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NetworkMapping"]] + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.UpdateNetworkMappingInput, IO], + **kwargs: Any + ) -> Optional[_models.NetworkMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'UpdateNetworkMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.NetworkMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "UpdateNetworkMappingInput") + + request = build_update_request( + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -507,144 +858,243 @@ def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NetworkMapping', pipeline_response) + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + + @overload def begin_update( self, - fabric_name, # type: str - network_name, # type: str - network_mapping_name, # type: str - input, # type: "_models.UpdateNetworkMappingInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.NetworkMapping"] + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: _models.UpdateNetworkMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: """Updates network mapping. The operation to update an ASR network mapping. - :param fabric_name: Primary fabric name. + :param fabric_name: Primary fabric name. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str - :param network_mapping_name: Network mapping name. + :param network_mapping_name: Network mapping name. Required. :type network_mapping_name: str - :param input: Update network mapping input. + :param input: Update network mapping input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either NetworkMapping or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update( + self, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param fabric_name: Primary fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.UpdateNetworkMappingInput, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param fabric_name: Primary fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkMapping or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.NetworkMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore fabric_name=fabric_name, network_name=network_name, network_mapping_name=network_mapping_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('NetworkMapping', pipeline_response) - + deserialized = self._deserialize("NetworkMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - 'networkMappingName': self._serialize.url("network_mapping_name", network_mapping_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkMappingCollection"] + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.NetworkMapping"]: """Gets all the network mappings under a vault. Lists all ASR network mappings in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkMappingCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either NetworkMapping or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkMappingCollection"] + _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.NetworkMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkMappingCollection', pipeline_response) + deserialized = self._deserialize("NetworkMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -653,7 +1103,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -662,7 +1114,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py index 4bcde4baf9b1..a9b5ae804eb5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,99 +6,219 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +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 HttpRequest, HttpResponse +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_by_replication_fabrics_request( + fabric_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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( + fabric_name: str, + network_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_name, "str"), + } - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + _url = _format_url_section(_url, **path_format_arguments) -class ReplicationNetworksOperations(object): - """ReplicationNetworksOperations operations. + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 ReplicationNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_networks` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_replication_fabrics( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkCollection"] + 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_by_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.Network"]: """Gets the list of networks under a fabric. Lists the networks available for a fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Network or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkCollection"] + _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.NetworkCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkCollection', pipeline_response) + deserialized = self._deserialize("NetworkCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,7 +227,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -115,123 +238,132 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks'} # type: ignore - - def get( - self, - fabric_name, # type: str - network_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Network" + return ItemPaged(get_next, extract_data) + + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks"} # type: ignore + + @distributed_trace + def get(self, fabric_name: str, network_name: str, **kwargs: Any) -> _models.Network: """Gets a network with specified server id and network name. Gets the details of a network. - :param fabric_name: Server Id. + :param fabric_name: Server Id. Required. :type fabric_name: str - :param network_name: Primary network name. + :param network_name: Primary network name. Required. :type network_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Network, or the result of cls(response) + :return: Network or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Network - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Network"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'networkName': self._serialize.url("network_name", network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Network] + + request = build_get_request( + fabric_name=fabric_name, + network_name=network_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('Network', pipeline_response) + deserialized = self._deserialize("Network", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}'} # type: ignore - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkCollection"] + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Network"]: """Gets the list of networks. View-only API. Lists the networks available in a vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Network or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkCollection"] + _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.NetworkCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkCollection', pipeline_response) + deserialized = self._deserialize("NetworkCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -240,7 +372,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -249,7 +383,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py index 5e8c4df515f8..7f4ec0c128e1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,97 +6,276 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +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_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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) + + +def build_get_request( + policy_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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_create_request( + policy_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_delete_request( + policy_name: str, resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_name, "str"), + } -class ReplicationPoliciesOperations(object): - """ReplicationPoliciesOperations operations. + _url = _format_url_section(_url, **path_format_arguments) - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_update_request( + policy_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class ReplicationPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PolicyCollection"] + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Policy"]: """Gets the list of replication policies. Lists the replication policies for a vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PolicyCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.PolicyCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Policy or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyCollection"] + _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.PolicyCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PolicyCollection', pipeline_response) + deserialized = self._deserialize("PolicyCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,7 +284,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -113,110 +295,115 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Policy" + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies"} # type: ignore + + @distributed_trace + def get(self, policy_name: str, **kwargs: Any) -> _models.Policy: """Gets the requested policy. Gets the details of a replication policy. - :param policy_name: Replication policy name. + :param policy_name: Replication policy name. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Policy, or the result of cls(response) + :return: Policy or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Policy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Policy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.Policy] + + request = build_get_request( + policy_name=policy_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('Policy', pipeline_response) + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore def _create_initial( - self, - policy_name, # type: str - input, # type: "_models.CreatePolicyInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Policy"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Policy"]] + self, policy_name: str, input: Union[_models.CreatePolicyInput, IO], **kwargs: Any + ) -> Optional[_models.Policy]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CreatePolicyInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Policy]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "CreatePolicyInput") + + request = build_create_request( + policy_name=policy_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -225,117 +412,182 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Policy', pipeline_response) + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore + + @overload def begin_create( self, - policy_name, # type: str - input, # type: "_models.CreatePolicyInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Policy"] + policy_name: str, + input: _models.CreatePolicyInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Policy]: """Creates the policy. The operation to create a replication policy. - :param policy_name: Replication policy name. + :param policy_name: Replication policy name. Required. :type policy_name: str - :param input: Create policy input. + :param input: Create policy input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Policy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Policy"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, policy_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Policy or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, policy_name: str, input: Union[_models.CreatePolicyInput, IO], **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Policy or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Policy] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore policy_name=policy_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Policy', pipeline_response) - + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( - self, - policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, policy_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + policy_name=policy_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -345,112 +597,114 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore - def begin_delete( - self, - policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + @distributed_trace + def begin_delete(self, policy_name: str, **kwargs: Any) -> LROPoller[None]: """Delete the policy. The operation to delete a replication policy. - :param policy_name: Replication policy name. + :param policy_name: Replication policy name. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore policy_name=policy_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore def _update_initial( - self, - policy_name, # type: str - input, # type: "_models.UpdatePolicyInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Policy"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Policy"]] + self, policy_name: str, input: Union[_models.UpdatePolicyInput, IO], **kwargs: Any + ) -> Optional[_models.Policy]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'UpdatePolicyInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.Policy]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "UpdatePolicyInput") + + request = build_update_request( + policy_name=policy_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -459,81 +713,144 @@ def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Policy', pipeline_response) + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore + + @overload def begin_update( self, - policy_name, # type: str - input, # type: "_models.UpdatePolicyInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Policy"] + policy_name: str, + input: _models.UpdatePolicyInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Policy]: """Updates the policy. The operation to update a replication policy. - :param policy_name: Policy Id. + :param policy_name: Policy Id. Required. :type policy_name: str - :param input: Update Policy Input. + :param input: Update Policy Input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Policy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Policy"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update( + self, policy_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param policy_name: Policy Id. Required. + :type policy_name: str + :param input: Update Policy Input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Policy or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, policy_name: str, input: Union[_models.UpdatePolicyInput, IO], **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param policy_name: Policy Id. Required. + :type policy_name: str + :param input: Update Policy Input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Policy or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.Policy] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore policy_name=policy_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Policy', pipeline_response) - + deserialized = self._deserialize("Policy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py index df2a3b109109..ed72fed85872 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,118 +6,227 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +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 HttpRequest, HttpResponse +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_by_replication_protection_containers_request( + fabric_name: str, + protection_container_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + take: Optional[str] = None, + skip_token: Optional[str] = None, + **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if take is not None: + _params["$take"] = _SERIALIZER.query("take", take, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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( + fabric_name: str, + protection_container_name: str, + protectable_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "protectableItemName": _SERIALIZER.url("protectable_item_name", protectable_item_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) + + +class ReplicationProtectableItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationProtectableItemsOperations(object): - """ReplicationProtectableItemsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protectable_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protection_containers( self, - fabric_name, # type: str - protection_container_name, # type: str - filter=None, # type: Optional[str] - take=None, # type: Optional[str] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProtectableItemCollection"] + fabric_name: str, + protection_container_name: str, + filter: Optional[str] = None, + take: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ProtectableItem"]: """Gets the list of protectable items. Lists the protectable items in a protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param take: take OData query parameter. + :param take: take OData query parameter. Default value is None. :type take: str - :param skip_token: skipToken OData query parameter. + :param skip_token: skipToken OData query parameter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectableItemCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectableItem or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectableItemCollection"] + _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.ProtectableItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protection_containers.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if take is not None: - query_parameters['$take'] = self._serialize.query("take", take, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protection_containers_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + take=take, + skip_token=skip_token, + api_version=api_version, + template_url=self.list_by_replication_protection_containers.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectableItemCollection', pipeline_response) + deserialized = self._deserialize("ProtectableItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -125,7 +235,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -134,74 +246,73 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_protection_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems'} # type: ignore + return ItemPaged(get_next, extract_data) + + list_by_replication_protection_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems"} # type: ignore + @distributed_trace def get( - self, - fabric_name, # type: str - protection_container_name, # type: str - protectable_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ProtectableItem" + self, fabric_name: str, protection_container_name: str, protectable_item_name: str, **kwargs: Any + ) -> _models.ProtectableItem: """Gets the details of a protectable item. The operation to get the details of a protectable item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param protectable_item_name: Protectable item name. + :param protectable_item_name: Protectable item name. Required. :type protectable_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectableItem, or the result of cls(response) + :return: ProtectableItem or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectableItem"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'protectableItemName': self._serialize.url("protectable_item_name", protectable_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ProtectableItem] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + protectable_item_name=protectable_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('ProtectableItem', pipeline_response) + deserialized = self._deserialize("ProtectableItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py index 79533a7f16d9..eba5475ddfa9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,105 +6,1082 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_replication_protection_containers_request( + fabric_name: str, + protection_container_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_create_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_purge_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_name, "str" + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_update_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_add_disks_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_apply_recovery_point_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_failover_cancel_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_failover_commit_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_planned_failover_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_delete_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_remove_disks_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_repair_replication_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_reprotect_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_resolve_health_errors_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_switch_provider_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_test_failover_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_test_failover_cleanup_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_unplanned_failover_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_update_appliance_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_update_mobility_service_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +def build_list_request( + resource_name: str, + resource_group_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ReplicationProtectedItemsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationProtectedItemsOperations(object): - """ReplicationProtectedItemsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protected_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protection_containers( - self, - fabric_name, # type: str - protection_container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationProtectedItemCollection"] + self, fabric_name: str, protection_container_name: str, **kwargs: Any + ) -> Iterable["_models.ReplicationProtectedItem"]: """Gets the list of Replication protected items. Gets the list of ASR replication protected items in the protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationProtectedItemCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItemCollection"] + _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.ReplicationProtectedItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protection_containers.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protection_containers_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_protection_containers.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItemCollection', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,7 +1090,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -121,122 +1101,130 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_protection_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems'} # type: ignore + return ItemPaged(get_next, extract_data) + + list_by_replication_protection_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems"} # type: ignore + @distributed_trace def get( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ReplicationProtectedItem" + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> _models.ReplicationProtectedItem: """Gets the details of a Replication protected item. Gets the details of an ASR replication protected item. - :param fabric_name: Fabric unique name. + :param fabric_name: Fabric unique name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationProtectedItem, or the result of cls(response) + :return: ReplicationProtectedItem or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ReplicationProtectedItem] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore def _create_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - input, # type: "_models.EnableProtectionInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: Union[_models.EnableProtectionInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'EnableProtectionInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "EnableProtectionInput") + + request = build_create_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -245,131 +1233,218 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore + + @overload def begin_create( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - input, # type: "_models.EnableProtectionInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: _models.EnableProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Enables protection. The operation to create an ASR replication protected item (Enable replication). - :param fabric_name: Name of the fabric. + :param fabric_name: Name of the fabric. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: A name for the replication protected item. + :param replicated_protected_item_name: A name for the replication protected item. Required. :type replicated_protected_item_name: str - :param input: Enable Protection Input. + :param input: Enable Protection Input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param fabric_name: Name of the fabric. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: A name for the replication protected item. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: Union[_models.EnableProtectionInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param fabric_name: Name of the fabric. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: A name for the replication protected item. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _purge_initial( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore + + def _purge_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_purge_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -379,128 +1454,131 @@ def _purge_initial( if cls: return cls(pipeline_response, None, {}) - _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore + @distributed_trace def begin_purge( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> LROPoller[None]: """Purges protection. The operation to delete or purge a replication protected item. This operation will force delete the replication protected item. Use the remove operation on replication protected item to perform a clean disable replication for the item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_initial( + raw_result = self._purge_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore def _update_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - update_protection_input, # type: "_models.UpdateReplicationProtectedItemInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_protection_input, 'UpdateReplicationProtectedItemInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_protection_input, (IO, bytes)): + _content = update_protection_input + else: + _json = self._serialize.body(update_protection_input, "UpdateReplicationProtectedItemInput") + + request = build_update_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -509,139 +1587,238 @@ def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore + + @overload def begin_update( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - update_protection_input, # type: "_models.UpdateReplicationProtectedItemInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: _models.UpdateReplicationProtectedItemInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Updates the replication protected item settings. The operation to update the recovery settings of an ASR replication protected item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param update_protection_input: Update protection input. - :type update_protection_input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput + :param update_protection_input: Update protection input. Required. + :type update_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Required. + :type update_protection_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Is either a model type or a IO type. + Required. + :type update_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, update_protection_input=update_protection_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"} # type: ignore def _add_disks_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - add_disks_input, # type: "_models.AddDisksInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: Union[_models.AddDisksInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._add_disks_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(add_disks_input, 'AddDisksInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(add_disks_input, (IO, bytes)): + _content = add_disks_input + else: + _json = self._serialize.body(add_disks_input, "AddDisksInput") + + request = build_add_disks_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._add_disks_initial.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, 202]: @@ -650,139 +1827,235 @@ def _add_disks_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _add_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks'} # type: ignore + _add_disks_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks"} # type: ignore + + @overload def begin_add_disks( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - add_disks_input, # type: "_models.AddDisksInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: _models.AddDisksInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Add disk(s) for protection. Operation to add disks(s) to the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param add_disks_input: Add disks input. + :param add_disks_input: Add disks input. Required. :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_add_disks( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Required. + :type add_disks_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_add_disks( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: Union[_models.AddDisksInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Is either a model type or a IO type. Required. + :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._add_disks_initial( + raw_result = self._add_disks_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, add_disks_input=add_disks_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_add_disks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_add_disks.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks"} # type: ignore def _apply_recovery_point_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - apply_recovery_point_input, # type: "_models.ApplyRecoveryPointInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._apply_recovery_point_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(apply_recovery_point_input, 'ApplyRecoveryPointInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apply_recovery_point_input, (IO, bytes)): + _content = apply_recovery_point_input + else: + _json = self._serialize.body(apply_recovery_point_input, "ApplyRecoveryPointInput") + + request = build_apply_recovery_point_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._apply_recovery_point_initial.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, 202]: @@ -791,133 +2064,221 @@ def _apply_recovery_point_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _apply_recovery_point_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint'} # type: ignore + _apply_recovery_point_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint"} # type: ignore + + @overload def begin_apply_recovery_point( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - apply_recovery_point_input, # type: "_models.ApplyRecoveryPointInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: _models.ApplyRecoveryPointInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Change or apply recovery point. The operation to change the recovery point of a failed over replication protected item. - :param fabric_name: The ARM fabric name. + :param fabric_name: The ARM fabric name. Required. :type fabric_name: str - :param protection_container_name: The protection container name. + :param protection_container_name: The protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: The replicated protected item name. + :param replicated_protected_item_name: The replicated protected item name. Required. :type replicated_protected_item_name: str - :param apply_recovery_point_input: The ApplyRecoveryPointInput. - :type apply_recovery_point_input: ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_apply_recovery_point( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param fabric_name: The ARM fabric name. Required. + :type fabric_name: str + :param protection_container_name: The protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The replicated protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_apply_recovery_point( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param fabric_name: The ARM fabric name. Required. + :type fabric_name: str + :param protection_container_name: The protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The replicated protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Is either a model type or a IO + type. Required. + :type apply_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._apply_recovery_point_initial( + raw_result = self._apply_recovery_point_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, apply_recovery_point_input=apply_recovery_point_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_apply_recovery_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_apply_recovery_point.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint"} # type: ignore def _failover_cancel_initial( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._failover_cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.ReplicationProtectedItem]] + + request = build_failover_cancel_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._failover_cancel_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -926,129 +2287,123 @@ def _failover_cancel_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _failover_cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel'} # type: ignore + _failover_cancel_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel"} # type: ignore + + @distributed_trace def begin_failover_cancel( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Execute cancel failover. Operation to cancel the failover of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._failover_cancel_initial( + raw_result = self._failover_cancel_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_failover_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_failover_cancel.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel"} # type: ignore def _failover_commit_initial( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._failover_commit_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.ReplicationProtectedItem]] + + request = build_failover_commit_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._failover_commit_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1057,135 +2412,140 @@ def _failover_commit_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _failover_commit_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit'} # type: ignore + _failover_commit_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit"} # type: ignore + + @distributed_trace def begin_failover_commit( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Execute commit failover. Operation to commit the failover of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._failover_commit_initial( + raw_result = self._failover_commit_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_failover_commit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_failover_commit.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit"} # type: ignore def _planned_failover_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - failover_input, # type: "_models.PlannedFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.PlannedFailoverInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._planned_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(failover_input, 'PlannedFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(failover_input, (IO, bytes)): + _content = failover_input + else: + _json = self._serialize.body(failover_input, "PlannedFailoverInput") + + request = build_planned_failover_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._planned_failover_initial.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, 202]: @@ -1194,137 +2554,236 @@ def _planned_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _planned_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover'} # type: ignore + _planned_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover"} # type: ignore + + @overload def begin_planned_failover( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - failover_input, # type: "_models.PlannedFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: _models.PlannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Execute planned failover. Operation to initiate a planned failover of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param failover_input: Planned failover input. + :param failover_input: Planned failover input. Required. :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_planned_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Required. + :type failover_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_planned_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.PlannedFailoverInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Is either a model type or a IO type. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._planned_failover_initial( + raw_result = self._planned_failover_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, failover_input=failover_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_planned_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_planned_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - disable_protection_input, # type: "_models.DisableProtectionInput" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: Union[_models.DisableProtectionInput, IO], + **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, '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", 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] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(disable_protection_input, (IO, bytes)): + _content = disable_protection_input + else: + _json = self._serialize.body(disable_protection_input, "DisableProtectionInput") + + request = build_delete_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(disable_protection_input, 'DisableProtectionInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1334,131 +2793,226 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove"} # type: ignore + @overload def begin_delete( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - disable_protection_input, # type: "_models.DisableProtectionInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: _models.DisableProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: """Disables protection. The operation to disable replication on a replication protected item. This will also remove the item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param disable_protection_input: Disable protection input. - :type disable_protection_input: ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_delete( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_delete( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: Union[_models.DisableProtectionInput, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Is either a model type or a IO type. + Required. + :type disable_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, disable_protection_input=disable_protection_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove"} # type: ignore def _remove_disks_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - remove_disks_input, # type: "_models.RemoveDisksInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: Union[_models.RemoveDisksInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._remove_disks_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(remove_disks_input, 'RemoveDisksInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(remove_disks_input, (IO, bytes)): + _content = remove_disks_input + else: + _json = self._serialize.body(remove_disks_input, "RemoveDisksInput") + + request = build_remove_disks_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._remove_disks_initial.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, 202]: @@ -1467,133 +3021,219 @@ def _remove_disks_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _remove_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks'} # type: ignore + _remove_disks_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks"} # type: ignore + + @overload def begin_remove_disks( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - remove_disks_input, # type: "_models.RemoveDisksInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: _models.RemoveDisksInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Removes disk(s). Operation to remove disk(s) from the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param remove_disks_input: Remove disks input. + :param remove_disks_input: Remove disks input. Required. :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_remove_disks( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Required. + :type remove_disks_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_remove_disks( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: Union[_models.RemoveDisksInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Is either a model type or a IO type. Required. + :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._remove_disks_initial( + raw_result = self._remove_disks_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, remove_disks_input=remove_disks_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_remove_disks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_remove_disks.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks"} # type: ignore def _repair_replication_initial( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._repair_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.ReplicationProtectedItem]] + + request = build_repair_replication_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._repair_replication_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1602,136 +3242,141 @@ def _repair_replication_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _repair_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication'} # type: ignore + _repair_replication_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication"} # type: ignore + + @distributed_trace def begin_repair_replication( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Resynchronize or repair replication. The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. - :param fabric_name: The name of the fabric. + :param fabric_name: The name of the fabric. Required. :type fabric_name: str - :param protection_container_name: The name of the container. + :param protection_container_name: The name of the container. Required. :type protection_container_name: str - :param replicated_protected_item_name: The name of the replication protected item. + :param replicated_protected_item_name: The name of the replication protected item. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._repair_replication_initial( + raw_result = self._repair_replication_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_repair_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_repair_replication.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication"} # type: ignore def _reprotect_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - reprotect_input, # type: "_models.ReverseReplicationInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: Union[_models.ReverseReplicationInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reprotect_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(reprotect_input, 'ReverseReplicationInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(reprotect_input, (IO, bytes)): + _content = reprotect_input + else: + _json = self._serialize.body(reprotect_input, "ReverseReplicationInput") + + request = build_reprotect_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reprotect_initial.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, 202]: @@ -1740,139 +3385,237 @@ def _reprotect_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _reprotect_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect'} # type: ignore + _reprotect_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect"} # type: ignore + + @overload def begin_reprotect( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - reprotect_input, # type: "_models.ReverseReplicationInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: _models.ReverseReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Execute Reverse Replication\Reprotect. Operation to reprotect or reverse replicate a failed over replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param reprotect_input: Reverse replication input. + :param reprotect_input: Reverse replication input. Required. :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_reprotect( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Required. + :type reprotect_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reprotect( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: Union[_models.ReverseReplicationInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Is either a model type or a IO type. + Required. + :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._reprotect_initial( + raw_result = self._reprotect_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, reprotect_input=reprotect_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reprotect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reprotect.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect"} # type: ignore def _resolve_health_errors_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - resolve_health_input, # type: "_models.ResolveHealthInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: Union[_models.ResolveHealthInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._resolve_health_errors_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resolve_health_input, 'ResolveHealthInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resolve_health_input, (IO, bytes)): + _content = resolve_health_input + else: + _json = self._serialize.body(resolve_health_input, "ResolveHealthInput") + + request = build_resolve_health_errors_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resolve_health_errors_initial.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, 202]: @@ -1881,139 +3624,479 @@ def _resolve_health_errors_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _resolve_health_errors_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors'} # type: ignore + _resolve_health_errors_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors"} # type: ignore + + @overload def begin_resolve_health_errors( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - resolve_health_input, # type: "_models.ResolveHealthInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: _models.ResolveHealthInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Resolve health errors. Operation to resolve health issues of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param resolve_health_input: Health issue input object. + :param resolve_health_input: Health issue input object. Required. :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_resolve_health_errors( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Required. + :type resolve_health_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resolve_health_errors( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: Union[_models.ResolveHealthInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Is either a model type or a IO type. + Required. + :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._resolve_health_errors_initial( + raw_result = self._resolve_health_errors_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, resolve_health_input=resolve_health_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resolve_health_errors.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors"} # type: ignore + + def _switch_provider_initial( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: Union[_models.SwitchProviderInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(switch_provider_input, (IO, bytes)): + _content = switch_provider_input + else: + _json = self._serialize.body(switch_provider_input, "SwitchProviderInput") + + request = build_switch_provider_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._switch_provider_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _switch_provider_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider"} # type: ignore + + @overload + def begin_switch_provider( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: _models.SwitchProviderInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_switch_provider( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_switch_provider( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: Union[_models.SwitchProviderInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Is either a model type or a IO type. + Required. + :type switch_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._switch_provider_initial( # type: ignore + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + switch_provider_input=switch_provider_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_resolve_health_errors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_switch_provider.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider"} # type: ignore def _test_failover_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - testfailover_input, # type: "_models.TestFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: Union[_models.TestFailoverInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(testfailover_input, 'TestFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(testfailover_input, (IO, bytes)): + _content = testfailover_input + else: + _json = self._serialize.body(testfailover_input, "TestFailoverInput") + + request = build_test_failover_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_failover_initial.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, 202]: @@ -2022,139 +4105,236 @@ def _test_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover'} # type: ignore + _test_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover"} # type: ignore + + @overload def begin_test_failover( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - testfailover_input, # type: "_models.TestFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: _models.TestFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Execute test failover. Operation to perform a test failover of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param testfailover_input: Test failover input. + :param testfailover_input: Test failover input. Required. :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_test_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Required. + :type testfailover_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: Union[_models.TestFailoverInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Is either a model type or a IO type. Required. + :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._test_failover_initial( + raw_result = self._test_failover_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, testfailover_input=testfailover_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover"} # type: ignore def _test_failover_cleanup_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - cleanup_input, # type: "_models.TestFailoverCleanupInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: Union[_models.TestFailoverCleanupInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_failover_cleanup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cleanup_input, 'TestFailoverCleanupInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cleanup_input, (IO, bytes)): + _content = cleanup_input + else: + _json = self._serialize.body(cleanup_input, "TestFailoverCleanupInput") + + request = build_test_failover_cleanup_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_failover_cleanup_initial.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, 202]: @@ -2163,139 +4343,237 @@ def _test_failover_cleanup_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_failover_cleanup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup'} # type: ignore + _test_failover_cleanup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup"} # type: ignore + + @overload def begin_test_failover_cleanup( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - cleanup_input, # type: "_models.TestFailoverCleanupInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: _models.TestFailoverCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Execute test failover cleanup. Operation to clean up the test failover of a replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param cleanup_input: Test failover cleanup input. + :param cleanup_input: Test failover cleanup input. Required. :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_test_failover_cleanup( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover_cleanup( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: Union[_models.TestFailoverCleanupInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Is either a model type or a IO type. + Required. + :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._test_failover_cleanup_initial( + raw_result = self._test_failover_cleanup_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, cleanup_input=cleanup_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_failover_cleanup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_failover_cleanup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup"} # type: ignore def _unplanned_failover_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - failover_input, # type: "_models.UnplannedFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.UnplannedFailoverInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._unplanned_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(failover_input, 'UnplannedFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(failover_input, (IO, bytes)): + _content = failover_input + else: + _json = self._serialize.body(failover_input, "UnplannedFailoverInput") + + request = build_unplanned_failover_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._unplanned_failover_initial.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, 202]: @@ -2304,139 +4582,236 @@ def _unplanned_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _unplanned_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover'} # type: ignore + _unplanned_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover"} # type: ignore + + @overload def begin_unplanned_failover( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - failover_input, # type: "_models.UnplannedFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: _models.UnplannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Execute unplanned failover. Operation to initiate a failover of the replication protected item. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param failover_input: Failover input. + :param failover_input: Failover input. Required. :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_unplanned_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Required. + :type failover_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_unplanned_failover( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.UnplannedFailoverInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Is either a model type or a IO type. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._unplanned_failover_initial( + raw_result = self._unplanned_failover_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, failover_input=failover_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_unplanned_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_unplanned_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover"} # type: ignore def _update_appliance_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - appliance_update_input, # type: "_models.UpdateApplianceForReplicationProtectedItemInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_appliance_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(appliance_update_input, 'UpdateApplianceForReplicationProtectedItemInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(appliance_update_input, (IO, bytes)): + _content = appliance_update_input + else: + _json = self._serialize.body(appliance_update_input, "UpdateApplianceForReplicationProtectedItemInput") + + request = build_update_appliance_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_appliance_initial.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, 202]: @@ -2445,139 +4820,239 @@ def _update_appliance_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_appliance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance'} # type: ignore + _update_appliance_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance"} # type: ignore + + @overload def begin_update_appliance( self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - appliance_update_input, # type: "_models.UpdateApplianceForReplicationProtectedItemInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: _models.UpdateApplianceForReplicationProtectedItemInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Updates appliance for replication protected Item. The operation to update appliance of an ASR replication protected item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str - :param appliance_update_input: Appliance update protection input. - :type appliance_update_input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update_appliance( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_appliance( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Is either a model type or a + IO type. Required. + :type appliance_update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._update_appliance_initial( + raw_result = self._update_appliance_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, replicated_protected_item_name=replicated_protected_item_name, appliance_update_input=appliance_update_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_appliance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_appliance.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance"} # type: ignore def _update_mobility_service_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - replication_protected_item_name, # type: str - update_mobility_service_request, # type: "_models.UpdateMobilityServiceRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplicationProtectedItem"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplicationProtectedItem"]] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, IO], + **kwargs: Any + ) -> Optional[_models.ReplicationProtectedItem]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_mobility_service_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicationProtectedItemName': self._serialize.url("replication_protected_item_name", replication_protected_item_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_mobility_service_request, 'UpdateMobilityServiceRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ReplicationProtectedItem]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_mobility_service_request, (IO, bytes)): + _content = update_mobility_service_request + else: + _json = self._serialize.body(update_mobility_service_request, "UpdateMobilityServiceRequest") + + request = build_update_mobility_service_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_mobility_service_initial.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, 202]: @@ -2586,158 +5061,267 @@ def _update_mobility_service_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_mobility_service_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicationProtectedItemName}/updateMobilityService'} # type: ignore + _update_mobility_service_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService"} # type: ignore + + @overload def begin_update_mobility_service( self, - fabric_name, # type: str - protection_container_name, # type: str - replication_protected_item_name, # type: str - update_mobility_service_request, # type: "_models.UpdateMobilityServiceRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplicationProtectedItem"] + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: _models.UpdateMobilityServiceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: """Update the mobility service on a protected item. The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version. - :param fabric_name: The name of the fabric containing the protected item. + :param fabric_name: The name of the fabric containing the protected item. Required. :type fabric_name: str :param protection_container_name: The name of the container containing the protected item. + Required. :type protection_container_name: str - :param replication_protected_item_name: The name of the protected item on which the agent is to - be updated. - :type replication_protected_item_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str :param update_mobility_service_request: Request to update the mobility service on the protected - item. - :type update_mobility_service_request: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest + item. Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItem"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update_mobility_service( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param fabric_name: The name of the fabric containing the protected item. Required. + :type fabric_name: str + :param protection_container_name: The name of the container containing the protected item. + Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_mobility_service( + self, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param fabric_name: The name of the fabric containing the protected item. Required. + :type fabric_name: str + :param protection_container_name: The name of the container containing the protected item. + Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Is either a model type or a IO type. Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ReplicationProtectedItem] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._update_mobility_service_initial( + raw_result = self._update_mobility_service_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, - replication_protected_item_name=replication_protected_item_name, + replicated_protected_item_name=replicated_protected_item_name, update_mobility_service_request=update_mobility_service_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItem', pipeline_response) - + deserialized = self._deserialize("ReplicationProtectedItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicationProtectedItemName': self._serialize.url("replication_protected_item_name", replication_protected_item_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_mobility_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicationProtectedItemName}/updateMobilityService'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_mobility_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService"} # type: ignore + @distributed_trace def list( - self, - skip_token=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationProtectedItemCollection"] + self, skip_token: Optional[str] = None, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ReplicationProtectedItem"]: """Gets the list of replication protected items. Gets the list of ASR replication protected items in the vault. :param skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or - null. + null. Default value is None. :type skip_token: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationProtectedItemCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ReplicationProtectedItem or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectedItemCollection"] + _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.ReplicationProtectedItemCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationProtectedItemCollection', pipeline_response) + deserialized = self._deserialize("ReplicationProtectedItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -2746,7 +5330,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -2755,7 +5341,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py index ee58c95f7b15..05654d876de0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,105 +6,396 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_replication_protection_containers_request( + fabric_name: str, + protection_container_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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( + fabric_name: str, + protection_container_name: str, + mapping_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_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_create_request( + fabric_name: str, + protection_container_name: str, + mapping_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_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_purge_request( + fabric_name: str, + protection_container_name: str, + mapping_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_update_request( + fabric_name: str, + protection_container_name: str, + mapping_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + fabric_name: str, + protection_container_name: str, + mapping_name: str, + resource_name: str, + resource_group_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-10")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 ReplicationProtectionContainerMappingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationProtectionContainerMappingsOperations(object): - """ReplicationProtectionContainerMappingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protection_container_mappings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protection_containers( - self, - fabric_name, # type: str - protection_container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProtectionContainerMappingCollection"] + self, fabric_name: str, protection_container_name: str, **kwargs: Any + ) -> Iterable["_models.ProtectionContainerMapping"]: """Gets the list of protection container mappings for a protection container. Lists the protection container mappings for a protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerMappingCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectionContainerMapping or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMappingCollection"] + _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.ProtectionContainerMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protection_containers.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protection_containers_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_protection_containers.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectionContainerMappingCollection', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,7 +404,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -121,122 +415,130 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_protection_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings'} # type: ignore + return ItemPaged(get_next, extract_data) + list_by_replication_protection_containers.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings"} # type: ignore + + @distributed_trace def get( - self, - fabric_name, # type: str - protection_container_name, # type: str - mapping_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ProtectionContainerMapping" + self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any + ) -> _models.ProtectionContainerMapping: """Gets a protection container mapping. Gets the details of a protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection Container mapping name. + :param mapping_name: Protection Container mapping name. Required. :type mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainerMapping, or the result of cls(response) + :return: ProtectionContainerMapping or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMapping"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ProtectionContainerMapping] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('ProtectionContainerMapping', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore def _create_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - mapping_name, # type: str - creation_input, # type: "_models.CreateProtectionContainerMappingInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ProtectionContainerMapping"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainerMapping"]] + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: Union[_models.CreateProtectionContainerMappingInput, IO], + **kwargs: Any + ) -> Optional[_models.ProtectionContainerMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(creation_input, 'CreateProtectionContainerMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainerMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(creation_input, (IO, bytes)): + _content = creation_input + else: + _json = self._serialize.body(creation_input, "CreateProtectionContainerMappingInput") + + request = build_create_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -245,131 +547,220 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainerMapping', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore + + @overload def begin_create( self, - fabric_name, # type: str - protection_container_name, # type: str - mapping_name, # type: str - creation_input, # type: "_models.CreateProtectionContainerMappingInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ProtectionContainerMapping"] + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: _models.CreateProtectionContainerMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: """Create protection container mapping. The operation to create a protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection container mapping name. + :param mapping_name: Protection container mapping name. Required. :type mapping_name: str - :param creation_input: Mapping creation input. - :type creation_input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput + :param creation_input: Mapping creation input. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Required. + :type creation_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: Union[_models.CreateProtectionContainerMappingInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Is either a model type or a IO type. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainerMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, mapping_name=mapping_name, creation_input=creation_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainerMapping', pipeline_response) - + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _purge_initial( - self, - fabric_name, # type: str - protection_container_name, # type: str - mapping_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore + + def _purge_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_purge_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -379,126 +770,129 @@ def _purge_initial( if cls: return cls(pipeline_response, None, {}) - _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore + @distributed_trace def begin_purge( - self, - fabric_name, # type: str - protection_container_name, # type: str - mapping_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any + ) -> LROPoller[None]: """Purge protection container mapping. The operation to purge(force delete) a protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection container mapping name. + :param mapping_name: Protection container mapping name. Required. :type mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_initial( + raw_result = self._purge_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, mapping_name=mapping_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore def _update_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - mapping_name, # type: str - update_input, # type: "_models.UpdateProtectionContainerMappingInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ProtectionContainerMapping"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainerMapping"]] + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: Union[_models.UpdateProtectionContainerMappingInput, IO], + **kwargs: Any + ) -> Optional[_models.ProtectionContainerMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_input, 'UpdateProtectionContainerMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainerMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_input, (IO, bytes)): + _content = update_input + else: + _json = self._serialize.body(update_input, "UpdateProtectionContainerMappingInput") + + request = build_update_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -507,137 +901,237 @@ def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainerMapping', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore + + @overload def begin_update( self, - fabric_name, # type: str - protection_container_name, # type: str - mapping_name, # type: str - update_input, # type: "_models.UpdateProtectionContainerMappingInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ProtectionContainerMapping"] + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: _models.UpdateProtectionContainerMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: """Update protection container mapping. The operation to update protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection container mapping name. + :param mapping_name: Protection container mapping name. Required. :type mapping_name: str - :param update_input: Mapping update input. - :type update_input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput + :param update_input: Mapping update input. Required. + :type update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Required. + :type update_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: Union[_models.UpdateProtectionContainerMappingInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Is either a model type or a IO type. Required. + :type update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainerMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, mapping_name=mapping_name, update_input=update_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainerMapping', pipeline_response) - + deserialized = self._deserialize("ProtectionContainerMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - fabric_name, # type: str - protection_container_name, # type: str - mapping_name, # type: str - removal_input, # type: "_models.RemoveProtectionContainerMappingInput" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: Union[_models.RemoveProtectionContainerMappingInput, IO], + **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(removal_input, (IO, bytes)): + _content = removal_input + else: + _json = self._serialize.body(removal_input, "RemoveProtectionContainerMappingInput") + + request = build_delete_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(removal_input, 'RemoveProtectionContainerMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -647,135 +1141,231 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove"} # type: ignore + @overload def begin_delete( self, - fabric_name, # type: str - protection_container_name, # type: str - mapping_name, # type: str - removal_input, # type: "_models.RemoveProtectionContainerMappingInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: _models.RemoveProtectionContainerMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: """Remove protection container mapping. The operation to delete or remove a protection container mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param mapping_name: Protection container mapping name. + :param mapping_name: Protection container mapping name. Required. :type mapping_name: str - :param removal_input: Removal input. - :type removal_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput + :param removal_input: Removal input. Required. + :type removal_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_delete( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Required. + :type removal_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_delete( + self, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: Union[_models.RemoveProtectionContainerMappingInput, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Is either a model type or a IO type. Required. + :type removal_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, mapping_name=mapping_name, removal_input=removal_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'mappingName': self._serialize.url("mapping_name", mapping_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProtectionContainerMappingCollection"] + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ProtectionContainerMapping"]: """Gets the list of all protection container mappings in a vault. Lists the protection container mappings in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerMappingCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectionContainerMapping or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerMappingCollection"] + _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.ProtectionContainerMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectionContainerMappingCollection', pipeline_response) + deserialized = self._deserialize("ProtectionContainerMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -784,7 +1374,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -793,7 +1385,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py index 9e8b7e05492b..0aac4e4111d7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,101 +6,377 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_replication_fabrics_request( + fabric_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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( + fabric_name: str, + protection_container_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_create_request( + fabric_name: str, + protection_container_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_discover_protectable_item_request( + fabric_name: str, + protection_container_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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) + + +def build_delete_request( + fabric_name: str, + protection_container_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_switch_protection_request( + fabric_name: str, + protection_container_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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) + + +def build_list_request( + resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 ReplicationProtectionContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationProtectionContainersOperations(object): - """ReplicationProtectionContainersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protection_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list_by_replication_fabrics( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProtectionContainerCollection"] + @distributed_trace + def list_by_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.ProtectionContainer"]: """Gets the list of protection container for a fabric. Lists the protection containers in the specified fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectionContainer or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerCollection"] + _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.ProtectionContainerCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectionContainerCollection', pipeline_response) + deserialized = self._deserialize("ProtectionContainerCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,7 +385,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -117,116 +396,123 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - fabric_name, # type: str - protection_container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ProtectionContainer" + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers"} # type: ignore + + @distributed_trace + def get(self, fabric_name: str, protection_container_name: str, **kwargs: Any) -> _models.ProtectionContainer: """Gets the protection container details. Gets the details of a protection container. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainer, or the result of cls(response) + :return: ProtectionContainer or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainer"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ProtectionContainer] + + request = build_get_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('ProtectionContainer', pipeline_response) + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}"} # type: ignore def _create_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - creation_input, # type: "_models.CreateProtectionContainerInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ProtectionContainer"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainer"]] + fabric_name: str, + protection_container_name: str, + creation_input: Union[_models.CreateProtectionContainerInput, IO], + **kwargs: Any + ) -> Optional[_models.ProtectionContainer]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(creation_input, 'CreateProtectionContainerInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainer]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(creation_input, (IO, bytes)): + _content = creation_input + else: + _json = self._serialize.body(creation_input, "CreateProtectionContainerInput") + + request = build_create_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -235,132 +521,225 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainer', pipeline_response) + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}"} # type: ignore + + @overload def begin_create( self, - fabric_name, # type: str - protection_container_name, # type: str - creation_input, # type: "_models.CreateProtectionContainerInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ProtectionContainer"] + fabric_name: str, + protection_container_name: str, + creation_input: _models.CreateProtectionContainerInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: """Create a protection container. Operation to create a protection container. - :param fabric_name: Unique fabric ARM name. + :param fabric_name: Unique fabric ARM name. Required. :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. + :param protection_container_name: Unique protection container ARM name. Required. :type protection_container_name: str - :param creation_input: Creation input. - :type creation_input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput + :param creation_input: Creation input. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ProtectionContainer or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainer"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, + fabric_name: str, + protection_container_name: str, + creation_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param fabric_name: Unique fabric ARM name. Required. + :type fabric_name: str + :param protection_container_name: Unique protection container ARM name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Required. + :type creation_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + fabric_name: str, + protection_container_name: str, + creation_input: Union[_models.CreateProtectionContainerInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param fabric_name: Unique fabric ARM name. Required. + :type fabric_name: str + :param protection_container_name: Unique protection container ARM name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Is either a model type or a IO type. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainer] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, creation_input=creation_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainer', pipeline_response) - + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}"} # type: ignore def _discover_protectable_item_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - discover_protectable_item_request, # type: "_models.DiscoverProtectableItemRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ProtectionContainer"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainer"]] + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, IO], + **kwargs: Any + ) -> Optional[_models.ProtectionContainer]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._discover_protectable_item_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(discover_protectable_item_request, 'DiscoverProtectableItemRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainer]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(discover_protectable_item_request, (IO, bytes)): + _content = discover_protectable_item_request + else: + _json = self._serialize.body(discover_protectable_item_request, "DiscoverProtectableItemRequest") + + request = build_discover_protectable_item_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._discover_protectable_item_initial.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, 202]: @@ -369,124 +748,212 @@ def _discover_protectable_item_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainer', pipeline_response) + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _discover_protectable_item_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem'} # type: ignore + _discover_protectable_item_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem"} # type: ignore + + @overload def begin_discover_protectable_item( self, - fabric_name, # type: str - protection_container_name, # type: str - discover_protectable_item_request, # type: "_models.DiscoverProtectableItemRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ProtectionContainer"] + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: _models.DiscoverProtectableItemRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: """Adds a protectable item to the replication protection container. The operation to a add a protectable item to a protection container(Add physical server). - :param fabric_name: The name of the fabric. + :param fabric_name: The name of the fabric. Required. :type fabric_name: str - :param protection_container_name: The name of the protection container. + :param protection_container_name: The name of the protection container. Required. :type protection_container_name: str :param discover_protectable_item_request: The request object to add a protectable item. - :type discover_protectable_item_request: ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest + Required. + :type discover_protectable_item_request: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ProtectionContainer or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainer"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_discover_protectable_item( + self, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param fabric_name: The name of the fabric. Required. + :type fabric_name: str + :param protection_container_name: The name of the protection container. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. + Required. + :type discover_protectable_item_request: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_discover_protectable_item( + self, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param fabric_name: The name of the fabric. Required. + :type fabric_name: str + :param protection_container_name: The name of the protection container. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. Is + either a model type or a IO type. Required. + :type discover_protectable_item_request: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainer] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._discover_protectable_item_initial( + raw_result = self._discover_protectable_item_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, discover_protectable_item_request=discover_protectable_item_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainer', pipeline_response) - + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_discover_protectable_item.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( - self, - fabric_name, # type: str - protection_container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_discover_protectable_item.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, protection_container_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -496,119 +963,122 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove"} # type: ignore - def begin_delete( - self, - fabric_name, # type: str - protection_container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + @distributed_trace + def begin_delete(self, fabric_name: str, protection_container_name: str, **kwargs: Any) -> LROPoller[None]: """Removes a protection container. Operation to remove a protection container. - :param fabric_name: Unique fabric ARM name. + :param fabric_name: Unique fabric ARM name. Required. :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. + :param protection_container_name: Unique protection container ARM name. Required. :type protection_container_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove"} # type: ignore def _switch_protection_initial( self, - fabric_name, # type: str - protection_container_name, # type: str - switch_input, # type: "_models.SwitchProtectionInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ProtectionContainer"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainer"]] + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchProtectionInput, IO], + **kwargs: Any + ) -> Optional[_models.ProtectionContainer]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._switch_protection_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(switch_input, 'SwitchProtectionInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.ProtectionContainer]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(switch_input, (IO, bytes)): + _content = switch_input + else: + _json = self._serialize.body(switch_input, "SwitchProtectionInput") + + request = build_switch_protection_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._switch_protection_initial.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, 202]: @@ -617,140 +1087,236 @@ def _switch_protection_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainer', pipeline_response) + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _switch_protection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection'} # type: ignore + _switch_protection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection"} # type: ignore + + @overload def begin_switch_protection( self, - fabric_name, # type: str - protection_container_name, # type: str - switch_input, # type: "_models.SwitchProtectionInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ProtectionContainer"] + fabric_name: str, + protection_container_name: str, + switch_input: _models.SwitchProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: """Switches protection from one container to another or one replication provider to another. Operation to switch protection from one container to another or one replication provider to another. - :param fabric_name: Unique fabric name. + :param fabric_name: Unique fabric name. Required. :type fabric_name: str - :param protection_container_name: Protection container name. + :param protection_container_name: Protection container name. Required. :type protection_container_name: str - :param switch_input: Switch protection input. + :param switch_input: Switch protection input. Required. :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ProtectionContainer or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainer"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_switch_protection( + self, + fabric_name: str, + protection_container_name: str, + switch_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_switch_protection( + self, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchProtectionInput, IO], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param fabric_name: Unique fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Is either a model type or a IO type. Required. + :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProtectionContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.ProtectionContainer] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._switch_protection_initial( + raw_result = self._switch_protection_initial( # type: ignore fabric_name=fabric_name, protection_container_name=protection_container_name, switch_input=switch_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ProtectionContainer', pipeline_response) - + deserialized = self._deserialize("ProtectionContainer", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_switch_protection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProtectionContainerCollection"] + begin_switch_protection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ProtectionContainer"]: """Gets the list of all protection containers in a vault. Lists the protection containers in a vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ProtectionContainer or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerCollection"] + _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.ProtectionContainerCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProtectionContainerCollection', pipeline_response) + deserialized = self._deserialize("ProtectionContainerCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -759,7 +1325,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -768,7 +1336,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py index 452a54d00232..b662f9e656a1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,105 +6,233 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +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 HttpRequest, HttpResponse +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_name: str, + resource_group_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if take_token is not None: + _params["takeToken"] = _SERIALIZER.query("take_token", take_token, "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( + intent_object_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_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_create_request( + intent_object_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_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) + + +class ReplicationProtectionIntentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationProtectionIntentsOperations(object): - """ReplicationProtectionIntentsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protection_intents` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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, - skip_token=None, # type: Optional[str] - take_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationProtectionIntentCollection"] + self, skip_token: Optional[str] = None, take_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ReplicationProtectionIntent"]: """Gets the list of replication protection intent objects. Gets the list of ASR replication protection intent objects in the vault. - :param skip_token: The pagination token. + :param skip_token: The pagination token. Default value is None. :type skip_token: str - :param take_token: The page size. + :param take_token: The page size. Default value is None. :type take_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationProtectionIntentCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ReplicationProtectionIntent or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectionIntentCollection"] + _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.ReplicationProtectionIntentCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if take_token is not None: - query_parameters['takeToken'] = self._serialize.query("take_token", take_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + 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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationProtectionIntentCollection', pipeline_response) + deserialized = self._deserialize("ReplicationProtectionIntentCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,7 +241,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -121,133 +252,190 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - intent_object_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ReplicationProtectionIntent" + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents"} # type: ignore + + @distributed_trace + def get(self, intent_object_name: str, **kwargs: Any) -> _models.ReplicationProtectionIntent: """Gets the details of a Replication protection intent item. Gets the details of an ASR replication protection intent. - :param intent_object_name: Replication protection intent name. + :param intent_object_name: Replication protection intent name. Required. :type intent_object_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReplicationProtectionIntent, or the result of cls(response) + :return: ReplicationProtectionIntent or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectionIntent"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'intentObjectName': self._serialize.url("intent_object_name", intent_object_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.ReplicationProtectionIntent] + + request = build_get_request( + intent_object_name=intent_object_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('ReplicationProtectionIntent', pipeline_response) + deserialized = self._deserialize("ReplicationProtectionIntent", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}'} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}"} # type: ignore + + @overload def create( self, - intent_object_name, # type: str - input, # type: "_models.CreateProtectionIntentInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.ReplicationProtectionIntent" + intent_object_name: str, + input: _models.CreateProtectionIntentInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ReplicationProtectionIntent: """Create protection intent Resource. The operation to create an ASR replication protection intent item. - :param intent_object_name: A name for the replication protection item. + :param intent_object_name: A name for the replication protection item. Required. :type intent_object_name: str - :param input: Create Protection Intent Input. + :param input: Create Protection Intent Input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput + :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: ReplicationProtectionIntent or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, intent_object_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param intent_object_name: A name for the replication protection item. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Required. + :type input: 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: ReplicationProtectionIntent, or the result of cls(response) + :return: ReplicationProtectionIntent or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, intent_object_name: str, input: Union[_models.CreateProtectionIntentInput, IO], **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param intent_object_name: A name for the replication protection item. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput 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: ReplicationProtectionIntent or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationProtectionIntent"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'intentObjectName': self._serialize.url("intent_object_name", intent_object_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CreateProtectionIntentInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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.ReplicationProtectionIntent] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "CreateProtectionIntentInput") + + request = build_create_request( + intent_object_name=intent_object_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.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('ReplicationProtectionIntent', pipeline_response) + deserialized = self._deserialize("ReplicationProtectionIntent", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}'} # type: ignore + + create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py index 3bdd7240eafc..27db78bd03d0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,97 +6,513 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +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_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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) + + +def build_get_request( + recovery_plan_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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") -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + recovery_plan_name: str, resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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( + recovery_plan_name: str, resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -class ReplicationRecoveryPlansOperations(object): - """ReplicationRecoveryPlansOperations operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +def build_update_request( + recovery_plan_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_failover_cancel_request( + recovery_plan_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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="POST", url=_url, params=_params, headers=_headers, **kwargs) - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + +def build_failover_commit_request( + recovery_plan_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_planned_failover_request( + recovery_plan_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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) + + +def build_reprotect_request( + recovery_plan_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_test_failover_request( + recovery_plan_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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) + + +def build_test_failover_cleanup_request( + recovery_plan_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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) + + +def build_unplanned_failover_request( + recovery_plan_name: str, resource_name: str, resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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 ReplicationRecoveryPlansOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_recovery_plans` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RecoveryPlanCollection"] + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.RecoveryPlan"]: """Gets the list of recovery plans. Lists the recovery plans in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPlanCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RecoveryPlan or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlanCollection"] + _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.RecoveryPlanCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RecoveryPlanCollection', pipeline_response) + deserialized = self._deserialize("RecoveryPlanCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,7 +521,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -113,110 +532,115 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - recovery_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RecoveryPlan" + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans"} # type: ignore + + @distributed_trace + def get(self, recovery_plan_name: str, **kwargs: Any) -> _models.RecoveryPlan: """Gets the requested recovery plan. Gets the details of the recovery plan. - :param recovery_plan_name: Name of the recovery plan. + :param recovery_plan_name: Name of the recovery plan. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryPlan, or the result of cls(response) + :return: RecoveryPlan or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.RecoveryPlan] + + request = build_get_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore def _create_initial( - self, - recovery_plan_name, # type: str - input, # type: "_models.CreateRecoveryPlanInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryPlan"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.CreateRecoveryPlanInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CreateRecoveryPlanInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "CreateRecoveryPlanInput") + + request = build_create_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -225,117 +649,188 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore + + @overload def begin_create( self, - recovery_plan_name, # type: str - input, # type: "_models.CreateRecoveryPlanInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryPlan"] + recovery_plan_name: str, + input: _models.CreateRecoveryPlanInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: """Creates a recovery plan with the given details. The operation to create a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Recovery Plan creation input. + :param input: Recovery Plan creation input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, recovery_plan_name: str, input: Union[_models.CreateRecoveryPlanInput, IO], **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( - self, - recovery_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, recovery_plan_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -345,112 +840,114 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore - def begin_delete( - self, - recovery_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + @distributed_trace + def begin_delete(self, recovery_plan_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes the specified recovery plan. Delete a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore recovery_plan_name=recovery_plan_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore def _update_initial( - self, - recovery_plan_name, # type: str - input, # type: "_models.UpdateRecoveryPlanInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryPlan"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.UpdateRecoveryPlanInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'UpdateRecoveryPlanInput') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "UpdateRecoveryPlanInput") + + request = build_update_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -459,119 +956,186 @@ def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore + + @overload def begin_update( self, - recovery_plan_name, # type: str - input, # type: "_models.UpdateRecoveryPlanInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryPlan"] + recovery_plan_name: str, + input: _models.UpdateRecoveryPlanInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: """Updates the given recovery plan. The operation to update a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Update recovery plan input. + :param input: Update recovery plan input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, recovery_plan_name: str, input: Union[_models.UpdateRecoveryPlanInput, IO], **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _failover_cancel_initial( - self, - recovery_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryPlan"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"} # type: ignore + + def _failover_cancel_initial(self, recovery_plan_name: str, **kwargs: Any) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._failover_cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.RecoveryPlan]] + + request = build_failover_cancel_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._failover_cancel_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -580,115 +1144,111 @@ def _failover_cancel_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _failover_cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel'} # type: ignore - def begin_failover_cancel( - self, - recovery_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryPlan"] + _failover_cancel_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel"} # type: ignore + + @distributed_trace + def begin_failover_cancel(self, recovery_plan_name: str, **kwargs: Any) -> LROPoller[_models.RecoveryPlan]: """Execute cancel failover of the recovery plan. The operation to cancel the failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._failover_cancel_initial( + raw_result = self._failover_cancel_initial( # type: ignore recovery_plan_name=recovery_plan_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_failover_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _failover_commit_initial( - self, - recovery_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryPlan"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + begin_failover_cancel.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel"} # type: ignore + + def _failover_commit_initial(self, recovery_plan_name: str, **kwargs: Any) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._failover_commit_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.RecoveryPlan]] + + request = build_failover_commit_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._failover_commit_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -697,121 +1257,125 @@ def _failover_commit_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _failover_commit_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit'} # type: ignore - def begin_failover_commit( - self, - recovery_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryPlan"] + _failover_commit_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit"} # type: ignore + + @distributed_trace + def begin_failover_commit(self, recovery_plan_name: str, **kwargs: Any) -> LROPoller[_models.RecoveryPlan]: """Execute commit failover of the recovery plan. The operation to commit the failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._failover_commit_initial( + raw_result = self._failover_commit_initial( # type: ignore recovery_plan_name=recovery_plan_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_failover_commit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_failover_commit.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit"} # type: ignore def _planned_failover_initial( - self, - recovery_plan_name, # type: str - input, # type: "_models.RecoveryPlanPlannedFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryPlan"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanPlannedFailoverInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._planned_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'RecoveryPlanPlannedFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "RecoveryPlanPlannedFailoverInput") + + request = build_planned_failover_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._planned_failover_initial.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, 202]: @@ -820,119 +1384,187 @@ def _planned_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _planned_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover'} # type: ignore + _planned_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover"} # type: ignore + + @overload def begin_planned_failover( self, - recovery_plan_name, # type: str - input, # type: "_models.RecoveryPlanPlannedFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryPlan"] + recovery_plan_name: str, + input: _models.RecoveryPlanPlannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: """Execute planned failover of the recovery plan. The operation to start the planned failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Failover input. + :param input: Failover input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_planned_failover( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Failover input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_planned_failover( + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanPlannedFailoverInput, IO], **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Failover input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._planned_failover_initial( + raw_result = self._planned_failover_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_planned_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _reprotect_initial( - self, - recovery_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryPlan"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + begin_planned_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover"} # type: ignore + + def _reprotect_initial(self, recovery_plan_name: str, **kwargs: Any) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._reprotect_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.RecoveryPlan]] + + request = build_reprotect_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reprotect_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -941,121 +1573,125 @@ def _reprotect_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _reprotect_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect'} # type: ignore - def begin_reprotect( - self, - recovery_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryPlan"] + _reprotect_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect"} # type: ignore + + @distributed_trace + def begin_reprotect(self, recovery_plan_name: str, **kwargs: Any) -> LROPoller[_models.RecoveryPlan]: """Execute reprotect of the recovery plan. The operation to reprotect(reverse replicate) a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._reprotect_initial( + raw_result = self._reprotect_initial( # type: ignore recovery_plan_name=recovery_plan_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reprotect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reprotect.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect"} # type: ignore def _test_failover_initial( - self, - recovery_plan_name, # type: str - input, # type: "_models.RecoveryPlanTestFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryPlan"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'RecoveryPlanTestFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "RecoveryPlanTestFailoverInput") + + request = build_test_failover_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_failover_initial.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, 202]: @@ -1064,125 +1700,201 @@ def _test_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover'} # type: ignore + _test_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover"} # type: ignore + + @overload def begin_test_failover( self, - recovery_plan_name, # type: str - input, # type: "_models.RecoveryPlanTestFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryPlan"] + recovery_plan_name: str, + input: _models.RecoveryPlanTestFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: """Execute test failover of the recovery plan. The operation to start the test failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Recovery plan test failover input. + :param input: Recovery plan test failover input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_test_failover( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover( + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverInput, IO], **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._test_failover_initial( + raw_result = self._test_failover_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover"} # type: ignore def _test_failover_cleanup_initial( - self, - recovery_plan_name, # type: str - input, # type: "_models.RecoveryPlanTestFailoverCleanupInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryPlan"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverCleanupInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._test_failover_cleanup_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'RecoveryPlanTestFailoverCleanupInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "RecoveryPlanTestFailoverCleanupInput") + + request = build_test_failover_cleanup_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._test_failover_cleanup_initial.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, 202]: @@ -1191,125 +1903,203 @@ def _test_failover_cleanup_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _test_failover_cleanup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup'} # type: ignore + _test_failover_cleanup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup"} # type: ignore + + @overload def begin_test_failover_cleanup( self, - recovery_plan_name, # type: str - input, # type: "_models.RecoveryPlanTestFailoverCleanupInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryPlan"] + recovery_plan_name: str, + input: _models.RecoveryPlanTestFailoverCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: """Execute test failover cleanup of the recovery plan. The operation to cleanup test failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Recovery plan test failover cleanup input. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput + :param input: Recovery plan test failover cleanup input. Required. + :type input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_test_failover_cleanup( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover_cleanup( + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverCleanupInput, IO], **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Is either a model type or a IO type. + Required. + :type input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._test_failover_cleanup_initial( + raw_result = self._test_failover_cleanup_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_test_failover_cleanup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_failover_cleanup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup"} # type: ignore def _unplanned_failover_initial( - self, - recovery_plan_name, # type: str - input, # type: "_models.RecoveryPlanUnplannedFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryPlan"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryPlan"]] + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanUnplannedFailoverInput, IO], **kwargs: Any + ) -> Optional[_models.RecoveryPlan]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._unplanned_failover_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'RecoveryPlanUnplannedFailoverInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryPlan]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "RecoveryPlanUnplannedFailoverInput") + + request = build_unplanned_failover_request( + recovery_plan_name=recovery_plan_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._unplanned_failover_initial.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, 202]: @@ -1318,81 +2108,152 @@ def _unplanned_failover_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryPlan', pipeline_response) + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _unplanned_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover'} # type: ignore + _unplanned_failover_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover"} # type: ignore + + @overload def begin_unplanned_failover( self, - recovery_plan_name, # type: str - input, # type: "_models.RecoveryPlanUnplannedFailoverInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryPlan"] + recovery_plan_name: str, + input: _models.RecoveryPlanUnplannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: """Execute unplanned failover of the recovery plan. The operation to start the unplanned failover of a recovery plan. - :param recovery_plan_name: Recovery plan name. + :param recovery_plan_name: Recovery plan name. Required. :type recovery_plan_name: str - :param input: Recovery plan unplanned failover input. + :param input: Recovery plan unplanned failover input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryPlan or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPlan"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_unplanned_failover( + self, recovery_plan_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_unplanned_failover( + self, recovery_plan_name: str, input: Union[_models.RecoveryPlanUnplannedFailoverInput, IO], **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param recovery_plan_name: Recovery plan name. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Is either a model type or a IO type. + Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryPlan] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._unplanned_failover_initial( + raw_result = self._unplanned_failover_initial( # type: ignore recovery_plan_name=recovery_plan_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryPlan', pipeline_response) - + deserialized = self._deserialize("RecoveryPlan", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'recoveryPlanName': self._serialize.url("recovery_plan_name", recovery_plan_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_unplanned_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_unplanned_failover.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py index 5e8f20fb840e..4dbeae6e4f29 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,101 +6,368 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_replication_fabrics_request( + fabric_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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( + fabric_name: str, + provider_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_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_create_request( + fabric_name: str, + provider_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_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_purge_request( + fabric_name: str, + provider_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_refresh_provider_request( + fabric_name: str, + provider_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + fabric_name: str, + provider_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_list_request( + resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationRecoveryServicesProvidersOperations(object): - """ReplicationRecoveryServicesProvidersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # 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 ReplicationRecoveryServicesProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_recovery_services_providers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_fabrics( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RecoveryServicesProviderCollection"] + self, fabric_name: str, **kwargs: Any + ) -> Iterable["_models.RecoveryServicesProvider"]: """Gets the list of registered recovery services providers for the fabric. Lists the registered recovery services providers for the specified fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryServicesProviderCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RecoveryServicesProvider or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProviderCollection"] + _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.RecoveryServicesProviderCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RecoveryServicesProviderCollection', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProviderCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,7 +376,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -117,116 +387,123 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - fabric_name, # type: str - provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RecoveryServicesProvider" + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders"} # type: ignore + + @distributed_trace + def get(self, fabric_name: str, provider_name: str, **kwargs: Any) -> _models.RecoveryServicesProvider: """Gets the details of a recovery services provider. Gets the details of registered recovery services provider. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryServicesProvider, or the result of cls(response) + :return: RecoveryServicesProvider or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProvider"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.RecoveryServicesProvider] + + request = build_get_request( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('RecoveryServicesProvider', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore def _create_initial( self, - fabric_name, # type: str - provider_name, # type: str - add_provider_input, # type: "_models.AddRecoveryServicesProviderInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryServicesProvider"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryServicesProvider"]] + fabric_name: str, + provider_name: str, + add_provider_input: Union[_models.AddRecoveryServicesProviderInput, IO], + **kwargs: Any + ) -> Optional[_models.RecoveryServicesProvider]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(add_provider_input, 'AddRecoveryServicesProviderInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.RecoveryServicesProvider]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(add_provider_input, (IO, bytes)): + _content = add_provider_input + else: + _json = self._serialize.body(add_provider_input, "AddRecoveryServicesProviderInput") + + request = build_create_request( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -235,124 +512,209 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore + + @overload def begin_create( self, - fabric_name, # type: str - provider_name, # type: str - add_provider_input, # type: "_models.AddRecoveryServicesProviderInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryServicesProvider"] + fabric_name: str, + provider_name: str, + add_provider_input: _models.AddRecoveryServicesProviderInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryServicesProvider]: """Adds a recovery services provider. The operation to add a recovery services provider. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str - :param add_provider_input: Add provider input. - :type add_provider_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput + :param add_provider_input: Add provider input. Required. + :type add_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryServicesProvider or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryServicesProvider or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProvider"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, + fabric_name: str, + provider_name: str, + add_provider_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Required. + :type add_provider_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryServicesProvider or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + fabric_name: str, + provider_name: str, + add_provider_input: Union[_models.AddRecoveryServicesProviderInput, IO], + **kwargs: Any + ) -> LROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Is either a model type or a IO type. Required. + :type add_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryServicesProvider or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.RecoveryServicesProvider] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore fabric_name=fabric_name, provider_name=provider_name, add_provider_input=add_provider_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) - + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _purge_initial( - self, - fabric_name, # type: str - provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore + + def _purge_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, provider_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_purge_request( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -362,113 +724,106 @@ def _purge_initial( if cls: return cls(pipeline_response, None, {}) - _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + _purge_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore - def begin_purge( - self, - fabric_name, # type: str - provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + @distributed_trace + def begin_purge(self, fabric_name: str, provider_name: str, **kwargs: Any) -> LROPoller[None]: """Purges recovery service provider from fabric. The operation to purge(force delete) a recovery services provider from the vault. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_initial( + raw_result = self._purge_initial( # type: ignore fabric_name=fabric_name, provider_name=provider_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"} # type: ignore def _refresh_provider_initial( - self, - fabric_name, # type: str - provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RecoveryServicesProvider"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RecoveryServicesProvider"]] + self, fabric_name: str, provider_name: str, **kwargs: Any + ) -> Optional[_models.RecoveryServicesProvider]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._refresh_provider_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.RecoveryServicesProvider]] + + request = build_refresh_provider_request( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._refresh_provider_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -477,120 +832,119 @@ def _refresh_provider_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _refresh_provider_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider'} # type: ignore + _refresh_provider_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider"} # type: ignore + + @distributed_trace def begin_refresh_provider( - self, - fabric_name, # type: str - provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RecoveryServicesProvider"] + self, fabric_name: str, provider_name: str, **kwargs: Any + ) -> LROPoller[_models.RecoveryServicesProvider]: """Refresh details from the recovery services provider. The operation to refresh the information from the recovery services provider. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RecoveryServicesProvider or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RecoveryServicesProvider or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProvider"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryServicesProvider] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._refresh_provider_initial( + raw_result = self._refresh_provider_initial( # type: ignore fabric_name=fabric_name, provider_name=provider_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) - + deserialized = self._deserialize("RecoveryServicesProvider", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_refresh_provider.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( - self, - fabric_name, # type: str - provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_refresh_provider.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, provider_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + provider_name=provider_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -600,126 +954,136 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove"} # type: ignore - def begin_delete( - self, - fabric_name, # type: str - provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is unsupported. To maintain backward compatibility for released clients the object "deleteRspInput" is used (if the object is empty we assume that it is old client and continue the old behavior). + @distributed_trace + def begin_delete(self, fabric_name: str, provider_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is + unsupported. To maintain backward compatibility for released clients the object + "deleteRspInput" is used (if the object is empty we assume that it is old client and continue + the old behavior). The operation to removes/delete(unregister) a recovery services provider from the vault. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param provider_name: Recovery services provider name. + :param provider_name: Recovery services provider name. Required. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore fabric_name=fabric_name, provider_name=provider_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RecoveryServicesProviderCollection"] + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.RecoveryServicesProvider"]: """Gets the list of registered recovery services providers in the vault. This is a view only api. Lists the registered recovery services providers in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryServicesProviderCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RecoveryServicesProvider or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryServicesProviderCollection"] + _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.RecoveryServicesProviderCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RecoveryServicesProviderCollection', pipeline_response) + deserialized = self._deserialize("RecoveryServicesProviderCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -728,7 +1092,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -737,7 +1103,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py index 7cb2f2dd90df..51f760ca64d2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,105 +6,319 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_replication_storage_classifications_request( + fabric_name: str, + storage_classification_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_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( + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), + "storageClassificationMappingName": _SERIALIZER.url( + "storage_classification_mapping_name", storage_classification_mapping_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_create_request( + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), + "storageClassificationMappingName": _SERIALIZER.url( + "storage_classification_mapping_name", storage_classification_mapping_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( + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), + "storageClassificationMappingName": _SERIALIZER.url( + "storage_classification_mapping_name", storage_classification_mapping_name, "str" + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_list_request( + resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 ReplicationStorageClassificationMappingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationStorageClassificationMappingsOperations(object): - """ReplicationStorageClassificationMappingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_storage_classification_mappings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_storage_classifications( - self, - fabric_name, # type: str - storage_classification_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageClassificationMappingCollection"] + self, fabric_name: str, storage_classification_name: str, **kwargs: Any + ) -> Iterable["_models.StorageClassificationMapping"]: """Gets the list of storage classification mappings objects under a storage. Lists the storage classification mappings for the fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageClassificationMappingCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageClassificationMapping or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationMappingCollection"] + _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.StorageClassificationMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_storage_classifications.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_storage_classifications_request( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_storage_classifications.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageClassificationMappingCollection', pipeline_response) + deserialized = self._deserialize("StorageClassificationMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,7 +327,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -121,122 +338,134 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_storage_classifications.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings'} # type: ignore + return ItemPaged(get_next, extract_data) + list_by_replication_storage_classifications.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings"} # type: ignore + + @distributed_trace def get( self, - fabric_name, # type: str - storage_classification_name, # type: str - storage_classification_mapping_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageClassificationMapping" + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + **kwargs: Any + ) -> _models.StorageClassificationMapping: """Gets the details of a storage classification mapping. Gets the details of the specified storage classification mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. + :param storage_classification_mapping_name: Storage classification mapping name. Required. :type storage_classification_mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageClassificationMapping, or the result of cls(response) + :return: StorageClassificationMapping or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationMapping"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.StorageClassificationMapping] + + request = build_get_request( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('StorageClassificationMapping', pipeline_response) + deserialized = self._deserialize("StorageClassificationMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore def _create_initial( self, - fabric_name, # type: str - storage_classification_name, # type: str - storage_classification_mapping_name, # type: str - pairing_input, # type: "_models.StorageClassificationMappingInput" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageClassificationMapping"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageClassificationMapping"]] + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: Union[_models.StorageClassificationMappingInput, IO], + **kwargs: Any + ) -> Optional[_models.StorageClassificationMapping]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pairing_input, 'StorageClassificationMappingInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.StorageClassificationMapping]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pairing_input, (IO, bytes)): + _content = pairing_input + else: + _json = self._serialize.body(pairing_input, "StorageClassificationMappingInput") + + request = build_create_request( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -245,131 +474,224 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StorageClassificationMapping', pipeline_response) + deserialized = self._deserialize("StorageClassificationMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore + + @overload def begin_create( self, - fabric_name, # type: str - storage_classification_name, # type: str - storage_classification_mapping_name, # type: str - pairing_input, # type: "_models.StorageClassificationMappingInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageClassificationMapping"] + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: _models.StorageClassificationMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageClassificationMapping]: """Create storage classification mapping. The operation to create a storage classification mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. + :param storage_classification_mapping_name: Storage classification mapping name. Required. :type storage_classification_mapping_name: str - :param pairing_input: Pairing input. - :type pairing_input: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput + :param pairing_input: Pairing input. Required. + :type pairing_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageClassificationMapping or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageClassificationMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationMapping"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Required. + :type pairing_input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageClassificationMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: Union[_models.StorageClassificationMappingInput, IO], + **kwargs: Any + ) -> LROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Is either a model type or a IO type. Required. + :type pairing_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageClassificationMapping or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.StorageClassificationMapping] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore fabric_name=fabric_name, storage_classification_name=storage_classification_name, storage_classification_mapping_name=storage_classification_mapping_name, pairing_input=pairing_input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('StorageClassificationMapping', pipeline_response) - + deserialized = self._deserialize("StorageClassificationMapping", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - fabric_name, # type: str - storage_classification_name, # type: str - storage_classification_mapping_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -379,131 +701,142 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore + @distributed_trace def begin_delete( self, - fabric_name, # type: str - storage_classification_name, # type: str - storage_classification_mapping_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a storage classification mapping. The operation to delete a storage classification mapping. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. + :param storage_classification_mapping_name: Storage classification mapping name. Required. :type storage_classification_mapping_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore fabric_name=fabric_name, storage_classification_name=storage_classification_name, storage_classification_mapping_name=storage_classification_mapping_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - 'storageClassificationMappingName': self._serialize.url("storage_classification_mapping_name", storage_classification_mapping_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageClassificationMappingCollection"] + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.StorageClassificationMapping"]: """Gets the list of storage classification mappings objects under a vault. Lists the storage classification mappings in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageClassificationMappingCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageClassificationMapping or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationMappingCollection"] + _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.StorageClassificationMappingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageClassificationMappingCollection', pipeline_response) + deserialized = self._deserialize("StorageClassificationMappingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -512,7 +845,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -521,7 +856,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py index a686f82ec3c0..aabeaf8a3d18 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,99 +6,221 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +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 HttpRequest, HttpResponse +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_by_replication_fabrics_request( + fabric_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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( + fabric_name: str, + storage_classification_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), + } - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + _url = _format_url_section(_url, **path_format_arguments) -class ReplicationStorageClassificationsOperations(object): - """ReplicationStorageClassificationsOperations operations. + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 ReplicationStorageClassificationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_storage_classifications` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_replication_fabrics( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageClassificationCollection"] + 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_by_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.StorageClassification"]: """Gets the list of storage classification objects under a fabric. Lists the storage classifications available in the specified fabric. - :param fabric_name: Site name of interest. + :param fabric_name: Site name of interest. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageClassificationCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageClassification or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationCollection"] + _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.StorageClassificationCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageClassificationCollection', pipeline_response) + deserialized = self._deserialize("StorageClassificationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,7 +229,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -115,123 +240,134 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications'} # type: ignore - - def get( - self, - fabric_name, # type: str - storage_classification_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageClassification" + return ItemPaged(get_next, extract_data) + + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications"} # type: ignore + + @distributed_trace + def get(self, fabric_name: str, storage_classification_name: str, **kwargs: Any) -> _models.StorageClassification: """Gets the details of a storage classification. Gets the details of the specified storage classification. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param storage_classification_name: Storage classification name. + :param storage_classification_name: Storage classification name. Required. :type storage_classification_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageClassification, or the result of cls(response) + :return: StorageClassification or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassification"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'storageClassificationName': self._serialize.url("storage_classification_name", storage_classification_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.StorageClassification] + + request = build_get_request( + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('StorageClassification', pipeline_response) + deserialized = self._deserialize("StorageClassification", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}'} # type: ignore - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageClassificationCollection"] + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.StorageClassification"]: """Gets the list of storage classification objects under a vault. Lists the storage classifications in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageClassificationCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either StorageClassification or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageClassificationCollection"] + _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.StorageClassificationCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageClassificationCollection', pipeline_response) + deserialized = self._deserialize("StorageClassificationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -240,7 +376,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -249,7 +387,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py index b7277e7ba229..1b4da2698648 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,134 +6,202 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class ReplicationVaultHealthOperations(object): - """ReplicationVaultHealthOperations operations. +def build_refresh_request( + resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + accept = _headers.pop("Accept", "application/json") - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ReplicationVaultHealthOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_vault_health` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get( - self, - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultHealthDetails" + 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 get(self, **kwargs: Any) -> _models.VaultHealthDetails: """Gets the health summary for the vault. Gets the health details of the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultHealthDetails, or the result of cls(response) + :return: VaultHealthDetails or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultHealthDetails"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.VaultHealthDetails] + + request = build_get_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('VaultHealthDetails', pipeline_response) + deserialized = self._deserialize("VaultHealthDetails", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth'} # type: ignore - - def _refresh_initial( - self, - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VaultHealthDetails"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VaultHealthDetails"]] + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth"} # type: ignore + + def _refresh_initial(self, **kwargs: Any) -> Optional[_models.VaultHealthDetails]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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[Optional[_models.VaultHealthDetails]] + + request = build_refresh_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._refresh_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -141,72 +210,68 @@ def _refresh_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VaultHealthDetails', pipeline_response) + deserialized = self._deserialize("VaultHealthDetails", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh'} # type: ignore - def begin_refresh( - self, - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VaultHealthDetails"] + _refresh_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh"} # type: ignore + + @distributed_trace + def begin_refresh(self, **kwargs: Any) -> LROPoller[_models.VaultHealthDetails]: """Refreshes health summary of the vault. Refreshes health summary of the vault. :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VaultHealthDetails or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VaultHealthDetails or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultHealthDetails"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.VaultHealthDetails] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._refresh_initial( - cls=lambda x,y,z: x, - **kwargs + raw_result = self._refresh_initial( # type: ignore + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('VaultHealthDetails', pipeline_response) - + deserialized = self._deserialize("VaultHealthDetails", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_refresh.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py index ad44479aaecf..a5069c37fa18 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,97 +6,216 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +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_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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) + + +def build_get_request( + vault_setting_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vaultSettingName": _SERIALIZER.url("vault_setting_name", vault_setting_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_create_request( + vault_setting_name: str, resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vaultSettingName": _SERIALIZER.url("vault_setting_name", vault_setting_name, "str"), + } -class ReplicationVaultSettingOperations(object): - """ReplicationVaultSettingOperations operations. + _url = _format_url_section(_url, **path_format_arguments) - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + # 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) + + +class ReplicationVaultSettingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_vault_setting` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultSettingCollection"] + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.VaultSetting"]: """Gets the list of vault setting. Gets the list of vault setting. This includes the Migration Hub connection settings. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VaultSettingCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either VaultSetting or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultSettingCollection"] + _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.VaultSettingCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultSettingCollection', pipeline_response) + deserialized = self._deserialize("VaultSettingCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,7 +224,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -113,191 +235,268 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - vault_setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultSetting" + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings"} # type: ignore + + @distributed_trace + def get(self, vault_setting_name: str, **kwargs: Any) -> _models.VaultSetting: """Gets the vault setting. Gets the vault setting. This includes the Migration Hub connection settings. - :param vault_setting_name: Vault setting name. + :param vault_setting_name: Vault setting name. Required. :type vault_setting_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultSetting, or the result of cls(response) + :return: VaultSetting or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultSetting"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultSettingName': self._serialize.url("vault_setting_name", vault_setting_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.VaultSetting] + + request = build_get_request( + vault_setting_name=vault_setting_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('VaultSetting', pipeline_response) + deserialized = self._deserialize("VaultSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}"} # type: ignore def _create_initial( - self, - vault_setting_name, # type: str - input, # type: "_models.VaultSettingCreationInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultSetting" - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultSetting"] + self, vault_setting_name: str, input: Union[_models.VaultSettingCreationInput, IO], **kwargs: Any + ) -> _models.VaultSetting: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultSettingName': self._serialize.url("vault_setting_name", vault_setting_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'VaultSettingCreationInput') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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.VaultSetting] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(input, (IO, bytes)): + _content = input + else: + _json = self._serialize.body(input, "VaultSettingCreationInput") + + request = build_create_request( + vault_setting_name=vault_setting_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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('VaultSetting', pipeline_response) + deserialized = self._deserialize("VaultSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}"} # type: ignore + + @overload def begin_create( self, - vault_setting_name, # type: str - input, # type: "_models.VaultSettingCreationInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VaultSetting"] - """Updates vault setting. A vault setting object is a singleton per vault and it is always present by default. + vault_setting_name: str, + input: _models.VaultSettingCreationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. The operation to configure vault setting. - :param vault_setting_name: Vault setting name. + :param vault_setting_name: Vault setting name. Required. :type vault_setting_name: str - :param input: Vault setting creation input. + :param input: Vault setting creation input. Required. :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VaultSetting or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VaultSetting or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultSetting"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, vault_setting_name: str, input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Required. + :type input: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VaultSetting or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, vault_setting_name: str, input: Union[_models.VaultSettingCreationInput, IO], **kwargs: Any + ) -> LROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Is either a model type or a IO type. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VaultSetting or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.VaultSetting] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore vault_setting_name=vault_setting_name, input=input, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('VaultSetting', pipeline_response) - + deserialized = self._deserialize("VaultSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'vaultSettingName': self._serialize.url("vault_setting_name", vault_setting_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py index 380e2d21010c..43078694faca 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,101 +6,335 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_replication_fabrics_request( + fabric_name: str, resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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( + fabric_name: str, + vcenter_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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_create_request( + fabric_name: str, + vcenter_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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( + fabric_name: str, + vcenter_name: str, + resource_name: str, + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-10")) # type: str + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_update_request( + fabric_name: str, + vcenter_name: str, + resource_name: str, + resource_group_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-10")) # 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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_name: str, resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 ReplicationvCentersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ReplicationvCentersOperations(object): - """ReplicationvCentersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replicationv_centers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") - def list_by_replication_fabrics( - self, - fabric_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VCenterCollection"] + @distributed_trace + def list_by_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.VCenter"]: """Gets the list of vCenter registered under a fabric. Lists the vCenter servers registered in a fabric. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VCenterCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenterCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either VCenter or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenterCollection"] + _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.VCenterCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_fabrics.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_fabrics_request( + fabric_name=fabric_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_fabrics.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VCenterCollection', pipeline_response) + deserialized = self._deserialize("VCenterCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,7 +343,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -117,116 +354,123 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_fabrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters'} # type: ignore + return ItemPaged(get_next, extract_data) - def get( - self, - fabric_name, # type: str - vcenter_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VCenter" + list_by_replication_fabrics.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters"} # type: ignore + + @distributed_trace + def get(self, fabric_name: str, vcenter_name: str, **kwargs: Any) -> _models.VCenter: """Gets the details of a vCenter. Gets the details of a registered vCenter server(Add vCenter server). - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param vcenter_name: vcenter name. + :param vcenter_name: vcenter name. Required. :type vcenter_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VCenter, or the result of cls(response) + :return: VCenter or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VCenter - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenter"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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.VCenter] + + request = build_get_request( + fabric_name=fabric_name, + vcenter_name=vcenter_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('VCenter', pipeline_response) + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore def _create_initial( self, - fabric_name, # type: str - vcenter_name, # type: str - add_v_center_request, # type: "_models.AddVCenterRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VCenter"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VCenter"]] + fabric_name: str, + vcenter_name: str, + add_v_center_request: Union[_models.AddVCenterRequest, IO], + **kwargs: Any + ) -> Optional[_models.VCenter]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(add_v_center_request, 'AddVCenterRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.VCenter]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(add_v_center_request, (IO, bytes)): + _content = add_v_center_request + else: + _json = self._serialize.body(add_v_center_request, "AddVCenterRequest") + + request = build_create_request( + fabric_name=fabric_name, + vcenter_name=vcenter_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -235,124 +479,203 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VCenter', pipeline_response) + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore + + @overload def begin_create( self, - fabric_name, # type: str - vcenter_name, # type: str - add_v_center_request, # type: "_models.AddVCenterRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VCenter"] + fabric_name: str, + vcenter_name: str, + add_v_center_request: _models.AddVCenterRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: """Add vCenter. The operation to create a vCenter object.. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param vcenter_name: vcenter name. + :param vcenter_name: vcenter name. Required. :type vcenter_name: str - :param add_v_center_request: The input to the add vCenter operation. + :param add_v_center_request: The input to the add vCenter operation. Required. :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either VCenter or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenter"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, + fabric_name: str, + vcenter_name: str, + add_v_center_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Required. + :type add_v_center_request: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VCenter or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + fabric_name: str, + vcenter_name: str, + add_v_center_request: Union[_models.AddVCenterRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Is either a model type or + a IO type. Required. + :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VCenter or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.VCenter] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore fabric_name=fabric_name, vcenter_name=vcenter_name, add_v_center_request=add_v_center_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('VCenter', pipeline_response) - + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( - self, - fabric_name, # type: str - vcenter_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, fabric_name: str, vcenter_name: str, **kwargs: Any + ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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( + fabric_name=fabric_name, + vcenter_name=vcenter_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - # Construct headers - header_parameters = {} # type: Dict[str, Any] + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -362,119 +685,122 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore - def begin_delete( - self, - fabric_name, # type: str - vcenter_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + @distributed_trace + def begin_delete(self, fabric_name: str, vcenter_name: str, **kwargs: Any) -> LROPoller[None]: """Remove vcenter operation. The operation to remove(unregister) a registered vCenter server from the vault. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param vcenter_name: vcenter name. + :param vcenter_name: vcenter name. Required. :type vcenter_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore fabric_name=fabric_name, vcenter_name=vcenter_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) + kwargs.pop("error_map", None) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore def _update_initial( self, - fabric_name, # type: str - vcenter_name, # type: str - update_v_center_request, # type: "_models.UpdateVCenterRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VCenter"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VCenter"]] + fabric_name: str, + vcenter_name: str, + update_v_center_request: Union[_models.UpdateVCenterRequest, IO], + **kwargs: Any + ) -> Optional[_models.VCenter]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_v_center_request, 'UpdateVCenterRequest') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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[Optional[_models.VCenter]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_v_center_request, (IO, bytes)): + _content = update_v_center_request + else: + _json = self._serialize.body(update_v_center_request, "UpdateVCenterRequest") + + request = build_update_request( + fabric_name=fabric_name, + vcenter_name=vcenter_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # 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, 202]: @@ -483,139 +809,229 @@ def _update_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VCenter', pipeline_response) + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore + + @overload def begin_update( self, - fabric_name, # type: str - vcenter_name, # type: str - update_v_center_request, # type: "_models.UpdateVCenterRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VCenter"] + fabric_name: str, + vcenter_name: str, + update_v_center_request: _models.UpdateVCenterRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: """Update vCenter operation. The operation to update a registered vCenter. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param vcenter_name: vcenter name. + :param vcenter_name: vcenter name. Required. :type vcenter_name: str - :param update_v_center_request: The input to the update vCenter operation. - :type update_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either VCenter or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenter"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update( + self, + fabric_name: str, + vcenter_name: str, + update_v_center_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VCenter or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + fabric_name: str, + vcenter_name: str, + update_v_center_request: Union[_models.UpdateVCenterRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Is either a model + type or a IO type. Required. + :type update_v_center_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VCenter or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_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.VCenter] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore fabric_name=fabric_name, vcenter_name=vcenter_name, update_v_center_request=update_v_center_request, - cls=lambda x,y,z: x, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('VCenter', pipeline_response) - + deserialized = self._deserialize("VCenter", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'vcenterName': self._serialize.url("vcenter_name", vcenter_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VCenterCollection"] + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.VCenter"]: """Gets the list of vCenter registered under the vault. Lists the vCenter servers registered in the vault. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VCenterCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenterCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either VCenter or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VCenterCollection"] + _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.VCenterCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_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: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VCenterCollection', pipeline_response) + deserialized = self._deserialize("VCenterCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -624,7 +1040,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -633,7 +1051,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters'} # type: ignore + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py index 48a0c5322e2f..5debbd926ff6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,101 +6,146 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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_get_request( + resource_name: str, + resource_group_name: str, + subscription_id: str, + *, + instance_type: Optional[str] = None, + **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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if instance_type is not None: + _params["instanceType"] = _SERIALIZER.query("instance_type", instance_type, "str") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") -class SupportedOperatingSystemsOperations(object): - """SupportedOperatingSystemsOperations operations. + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. +class SupportedOperatingSystemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`supported_operating_systems` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get( - self, - instance_type=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.SupportedOperatingSystems" + 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 get(self, instance_type: Optional[str] = None, **kwargs: Any) -> _models.SupportedOperatingSystems: """Gets the data of supported operating systems by SRS. Gets the data of supported operating systems by SRS. - :param instance_type: The instance type. + :param instance_type: The instance type. Default value is None. :type instance_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedOperatingSystems, or the result of cls(response) + :return: SupportedOperatingSystems or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOperatingSystems - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedOperatingSystems"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - url = self._client.format_url(url, **path_format_arguments) + 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.SupportedOperatingSystems] + + request = build_get_request( + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + instance_type=instance_type, + 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 + ) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if instance_type is not None: - query_parameters['instanceType'] = self._serialize.query("instance_type", instance_type, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(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('SupportedOperatingSystems', pipeline_response) + deserialized = self._deserialize("SupportedOperatingSystems", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems'} # type: ignore + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py index 0f33a774a7a4..e82e9293b2e7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,107 +6,169 @@ # 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 TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +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 HttpRequest, HttpResponse +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_by_replication_protected_items_request( + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resource_name: str, + resource_group_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-10")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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) + + +class TargetComputeSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class TargetComputeSizesOperations(object): - """TargetComputeSizesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicessiterecovery.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`target_compute_sizes` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_replication_protected_items( - self, - fabric_name, # type: str - protection_container_name, # type: str - replicated_protected_item_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TargetComputeSizeCollection"] + self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any + ) -> Iterable["_models.TargetComputeSize"]: """Gets the list of target compute sizes for the replication protected item. Lists the available target compute sizes for a replication protected item. - :param fabric_name: Fabric name. + :param fabric_name: Fabric name. Required. :type fabric_name: str - :param protection_container_name: protection container name. + :param protection_container_name: protection container name. Required. :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. + :param replicated_protected_item_name: Replication protected item name. Required. :type replicated_protected_item_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TargetComputeSizeCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeCollection] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either TargetComputeSize or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TargetComputeSizeCollection"] + _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.TargetComputeSizeCollection] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" + error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_replication_protected_items.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceName': self._serialize.url("self._config.resource_name", self._config.resource_name, 'str'), - 'resourceGroupName': self._serialize.url("self._config.resource_group_name", self._config.resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fabricName': self._serialize.url("fabric_name", fabric_name, 'str'), - 'protectionContainerName': self._serialize.url("protection_container_name", protection_container_name, 'str'), - 'replicatedProtectedItemName': self._serialize.url("replicated_protected_item_name", replicated_protected_item_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_replication_protected_items_request( + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resource_name=self._config.resource_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_replication_protected_items.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + # make call to next link with the client's api-version + _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", 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.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TargetComputeSizeCollection', pipeline_response) + deserialized = self._deserialize("TargetComputeSizeCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,7 +177,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -123,7 +188,6 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( - get_next, extract_data - ) - list_by_replication_protected_items.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes'} # type: ignore + return ItemPaged(get_next, extract_data) + + list_by_replication_protected_items.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes"} # type: ignore